• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Change Folder of Logs of PM2 and NPM

Scheduled Pinned Locked Moved Development
11 Posts 2 Posters 3.2k Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    thgmirror
    last edited by Apr 9, 2022, 7:20 AM

    Hi,

    Does anybody know how to change the location of the above mentioned folders? I would like to move them to var/log/

    Thank you in advance
    Thomas

    S 1 Reply Last reply Apr 9, 2022, 11:09 AM Reply Quote 0
    • S Offline
      sdetweil @thgmirror
      last edited by Apr 9, 2022, 11:09 AM

      @thgmirror you could make a linked folder from their orignal place to /var/log

      see the ln command

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      T 1 Reply Last reply Apr 9, 2022, 3:06 PM Reply Quote 0
      • T Offline
        thgmirror @sdetweil
        last edited by thgmirror Apr 9, 2022, 3:07 PM Apr 9, 2022, 3:06 PM

        @sdetweil Thank you for your reply, but I prefer to store the log-files physically at var/log.
        I currently use var/log as a RAMDisk, because I normally don’t need log-files. So I avoid a lot of write access to the SD-card, it is faster and safer for the SD…and after a reboot, everything is fine:-)
        My attempt is, to do this for npm and PM2-logs, too.
        As far as I know, I can start PM2 with parameters -o and -e and the new foldernames, but they destroyed my installation. Btw., how do you start PM2 in your script? I would like to add the parameters so it is automatically connected after reboot.
        Thomas

        S 1 Reply Last reply Apr 9, 2022, 3:15 PM Reply Quote 0
        • S Offline
          sdetweil @thgmirror
          last edited by sdetweil Apr 9, 2022, 3:15 PM Apr 9, 2022, 3:15 PM

          @thgmirror no… you misunsderstand the point

          make a folder in /var/log where u want them to BE

          then in the users home folder create a ‘fake’ .pm2 folder for the pm2 stuff
          which points to the /var/log folder using the ln command

          the pm2 app will be happy and NEVER know that the REAL location is /var/log

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          T 1 Reply Last reply Apr 9, 2022, 3:16 PM Reply Quote 1
          • T Offline
            thgmirror @sdetweil
            last edited by Apr 9, 2022, 3:16 PM

            @sdetweil Ah, OK, I will give it a try:-)

            S 1 Reply Last reply Apr 9, 2022, 3:23 PM Reply Quote 0
            • S Offline
              sdetweil @thgmirror
              last edited by sdetweil Apr 9, 2022, 3:34 PM Apr 9, 2022, 3:23 PM

              @thgmirror in the users home foder

              # get into the users home folder
              cd ~
              # move the .pm2 folder to /var/log, pick a name
              mv .pm2 /var/log/pm2.real
              # make a link to it from users home folder
              ln -s  /var/log/pm2.real .pm2
              

              oops, edited ln…

              target <- link
              from /var/log
              drwxrwxr-x 5 sam sam 4096 Apr 9 10:29 .pm2/

              then in home folder

              ls .pm2 will show files
              ls -laF
              will show that .pm2 is a link (and where to)
              from users home folder
              lrwxrwxrwx 1 sam sam 13 Apr 9 10:31 .pm2 -> /var/log/.pm2/

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              T 1 Reply Last reply Apr 9, 2022, 4:43 PM Reply Quote 0
              • T Offline
                thgmirror @sdetweil
                last edited by Apr 9, 2022, 4:43 PM

                @sdetweil but you know, a RAMDisk is volatile, I can’t copy something to a RAMDisk in forehand…it is gone after a reboot.

                S 1 Reply Last reply Apr 9, 2022, 4:45 PM Reply Quote 0
                • S Offline
                  sdetweil @thgmirror
                  last edited by sdetweil Apr 9, 2022, 4:47 PM Apr 9, 2022, 4:45 PM

                  @thgmirror then u will have to create target folder on boot…

                  note that pm2 stores config info in there too(the jobs it manages) … so it MUST be persistent

                  but you could just link the logs folder from the users real .pm2 folder (the stuff that is volatile…)

                  well, logs are useful but…

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  T 1 Reply Last reply Apr 9, 2022, 4:47 PM Reply Quote 0
                  • T Offline
                    thgmirror @sdetweil
                    last edited by Apr 9, 2022, 4:47 PM

                    @sdetweil and where is the PM2 start?
                    Of course it must be persistant, but I don’t want to change the location of the PM2-configuration.

                    S 2 Replies Last reply Apr 9, 2022, 5:03 PM Reply Quote 0
                    • S Offline
                      sdetweil @thgmirror
                      last edited by Apr 9, 2022, 5:03 PM

                      @thgmirror someplace in the .pm2 folder… no idea myself…

                      the .pm2/logs folder I know

                      never examined the others

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 1 / 2
                      1 / 2
                      • First post
                        1/11
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy