You are not logged in.
Pages: 1
Hi,
I want to create a rc.d script for tt-rss.
The script has to execute
/usr/bin/php /path/to/update.php -daemonand send the process into the background.
I read the coresponding wiki page.
However, it isn't a good solution to search for the pid using
pidof -o %PPID /usr/bin/phpsince other php processes may run.
What is the correct way to solve this problem?
Sven
Offline
Maybe use pgrep?
Not sure, but some options might help:
-n Select only the newest (most recently started) of the matching processes.
-o Select only the oldest (least recently started) of the matching processes
Offline
Thats it!
-f The pattern is normally only matched against the process name. When -f is set, the full command line is used.Thanks!
Offline
pgrep works like a charm. However, Iran into a new problem.
I want to start the program as user http.
su -c "my command" httpgives not the desired result. It seems that su with the user http is not allowed...
Offline
[karol@black ~]$ grep http /etc/passwd
http:x:33:33:http:/srv/http:/bin/false/bin/false is a dummy shell, so this might be the problem. Can you create another user e.g. http2 with a proper shell?
Offline
Ah, that's the problem.
I have to find another solution, since I want to create a package with the rc.d script.
Last edited by avanc (2011-08-13 16:23:43)
Offline
There are two possible solutions that I am aware of:
1. Use a .install script that adds the 'http2' user.
2. Use su with the '-s' flag to specify an alternate shell. This would probably be the better solution. Example:
su http -s "/bin/sh" -c "command"Last edited by bluepumpkin (2011-08-14 04:17:35)
Offline
Pages: 1