Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
#!/bin/sh is a interpreter directive that basically tells the shell what to use to run the program. The #! is causing the error. Does your start.sh script have that is the first line?
start program = "/home/user/start.sh"
You can specify the shell i.e.
start program = "/bin/sh /home/user/start.sh"
start program = "/home/user/start.sh" and start program = "/bin/sh /home/user/start.sh", but same error. I should notice that the gameserver, which I try to start with Monit, doesn't have a pid file, is this a problem for monit? And NO, in the first line of the start script there is no #!/bin/sh. It start so: ./hlds_run -game cstrike ....
Yes monit requires all programs to have a pid file. Your start.sh script will need to create a pid file. In addition you should use the full path instead of using ./hlds_run... The . is a shortcut for current working directory and only means something if there is a terminal window open. monit does run as root so it should have access to a users home directory but might be better from say putting the script in /usr/local/bin.
and when I type /etc/init.d/blah start/stop, the server start and stop correctly.
In Monit i have this:
check process gameserver with pidfile /home/dido/56/27050/pid.pid
start program = "/bin/sh /home/dido/56/27050/start.bat"
stop program = "/etc/init.d/blah stop"
But when I press Start Service in Monit - nothing happens.
When the server is started and I press Stop Service in Monit - script stops the service correct.
I also tried with:
start program = "/etc/init.d/blah start", but the result is the same.
Where am i wrong? I tried update-rc.d blah defaults, but:
update-rc.d: using dependency based boot sequencing
insserv: warning: script 'blah' missing LSB tags and overrides
insserv: There is a loop between service monit and blah if stopped
insserv: loop involving service blah at depth 2
insserv: loop involving service monit at depth 1
insserv: Stopping blah depends on monit and therefore on system facility `$all' which can not be true!
insserv: exiting now without changing boot order!
update-rc.d: error: insserv rejected the script header
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.