I am currently working on a project which needs to be added to inittab
so that the program loads during startup.
The program that I am trying to start is a c# mono application. I have created a start script and if the start script is run manually the program launches fine. However, when I put it into inittab
the program doesn't launch.
I've checked in /var/log/messages
but it doesn't say anything is wrong, it just says that it is reloading.
Below is what I have added to my inittab
script
bes:2345:respawn:/home/bits/MyProgram/start.myprogram
Thanks for any help you can provide
UPDATE
Below is the code in the start script which is located in /home/bits/MyProgram.
#!/bin/sh
cd /home/bits/MyProgram
/usr/bin/mono EmailServer.exe "$@"
I have also tried adding > mylog.txt onto the end of the line beginning with /usr/bin/mono e.g.
/usr/bin/mono EmailServer.exe "$@" > mylog.txt
If I run the start script manually, even if I am not in the directory where the start script is located it works fine, its just when I add it to inittab and run telinit q it never starts and the log isn't written to but the log does get written to if I start the program manually.
Thanks for any help you can provide.
Best Answer
The problem is simple, you are using OpenSuse 12.1 which uses systemd instead of your classic System V boot system.
To install a new service place create following file in /etc/systemd/system/myprogname.service
Aftwards run
systemctl daemon-reload
andsystemctl start myprogname.service
If you want to automatically restart MyProgname you have to add
to the service section.