Sample Header Ad - 728x90

monit:3: syntax error '='

0 votes
1 answer
302 views
I am trying to set up my virtual machine to shut down when my program completes, to stop the charges. I have written the following .monitrc for this purpose: SET DAEMON 30 CHECK PROCESS py MATCHING /usr/bin/python3 start program = "sudo /bin/systemctl poweroff -i" When I run monit, it responds: > /home/baruch/.monitrc:3: syntax error '=' monit -V responds: > monit -V > > This is Monit version 5.20.0 > > Built with ssl, with ipv6, with compression, with pam and with large files OS: Linux instance-1 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u1 (2019-09-20) x86_64 I tried a similar .monitrc on my home computer (Ubuntu 16.04, Monit version 5.16) and it works fine: SET DAEMON 30 CHECK PROCESS py MATCHING /home/baruch/datasets/Severstal/.env/bin/python3 start program = "/bin/systemctl poweroff -i" Please help. **EDIT:** I need sudo because my virtual machine is set up in such way that systemctl does not work without sudo (it asks for some credentials). However, sudo does not ask for any passwords, so it can be used in .monitrc. Apparently, monit complained that sudo in the start command was without its path. I changed my .monitrc as follows: SET DAEMON 30 CHECK PROCESS py MATCHING /usr/bin/python3 start program = "/usr/bin/sudo /bin/systemctl poweroff -i" In this way monit does not give any error message but does not work either. I tried to run it with a log, monit -l, and the log contains only the following: > [UTC Oct 26 20:27:31] info : Starting Monit 5.20.0 daemon > > [UTC Oct 26 20:27:31] info : 'instance-1' Monit 5.20.0 started > > [UTC Oct 26 20:31:01] info : Monit daemon with pid stopped > > [UTC Oct 26 20:31:01] info : 'instance-1' Monit 5.20.0 stopped > > [UTC Oct 26 20:31:20] info : Starting Monit 5.20.0 daemon > > [UTC Oct 26 20:31:20] info : 'instance-1' Monit 5.20.0 started > > [UTC Oct 26 20:35:32] info : Monit daemon with pid stopped > > [UTC Oct 26 20:35:32] info : 'instance-1' Monit 5.20.0 stopped (Stopping here refers to my commands monit quit.) Any help will be appreciated.
Asked by Baruch Youssin (101 rep)
Oct 25, 2019, 08:43 AM
Last activity: Oct 26, 2019, 08:55 PM