glances icon indicating copy to clipboard operation
glances copied to clipboard

autostart on macOS

Open schluden opened this issue 5 years ago • 2 comments

Hello, sorry that this will not be an bug report, furthermore I need some help, creating an autostart method on macOS. Hello, I love using glances on my devices. However I managed to export several graphs to my influxDB.

Now I am encountering the challenge, operating glances on my Mac.

So first I installed glances with brew. everything fine. But I was a bit surprised, figuring out, that MacOS has NO SYSTEMD! :-D

How do I set up an autostart like on UNIX systems with SystemD ??

On Debian stretch I use the following expression: /usr/bin/python /usr/local/bin/glances --quiet -t 15 --export influxdb,mqtt and it works fine.

Maybe there is a tutorial, I just missed?

Greetings

schluden avatar Jun 16 '20 16:06 schluden

Hi,

i am not a Mac OS user but this site explain how to run a script on startup:

https://medium.com/@fahimhossain_16989/adding-startup-scripts-to-launch-daemon-on-mac-os-x-sierra-10-12-6-7e0318c74de1

If you success, can you tell us back the procedure, i will add it to the Wiki.

nicolargo avatar Jul 20 '20 08:07 nicolargo

If it helps, I setup this for a similar project, metrics2mqtt. I am now moving over to Glances, but the principle here may be of use. https://github.com/jamiebegin/metrics2mqtt/pull/12/commits/be1271bbff5f4b69bf7df1d57fe7bf727adfa94b

seaniedan avatar May 19 '21 12:05 seaniedan

I spent way too long failing to get it to work with launchd, so I used pm2 instead. I put the following in glances.sh:

#!/bin/zsh
/System/Volumes/Data/Users/michaelblight/Library/Python/3.10/bin/glances -w

And then make it executable with chmod +x glances.sh. Then this can be run with pm2:

pm2 start glances.sh

I would have thought I should have been able to do the following, but it did not work:

pm2 start /System/Volumes/Data/Users/michaelblight/Library/Python/3.10/bin/glances -- -w

It runs, but it doesn't start the web server so I guess the "-w" isn't getting through despite it being after the "--" as expected for pm2.

michaelblight avatar Sep 26 '22 06:09 michaelblight

Please see https://gist.github.com/boneskull/e6d57d6793804f3e5f171cd5518cb08b to learn how to use launchctl to autostart glances in server mode on macOS.

jarroddaley avatar May 07 '23 19:05 jarroddaley