Jua*_*món 34 scripts upstart init pure-ftpd
Ubuntu 10.04
我创建了这个新贵脚本(/etc/init/pure-ftpd.conf):
# pure-ftpd - FTP server
description "Pure-FTPd server"
start on filesystem
stop on runlevel S
respawn
respawn limit 10 5
pid file /var/run/pure-ftpd.pid
console output
pre-start script
test -x /usr/local/sbin/pure-ftpd || { stop; exit 0; }
end script
exec /usr/local/sbin/pure-ftpd --maxclientsnumber 2 --maxclientsperip 10 --prohibitdotfileswrite --prohibitdotfilesread --noanonymous --chrooteveryone --dontresolve --nochmod --pidfile /var/run/pure-ftpd.pid
Run Code Online (Sandbox Code Playgroud)
但...
# start pure-ftpd
start: Unknown job: pure-ftpd
Run Code Online (Sandbox Code Playgroud)
和
# service pure-ftpd start
start: Unknown job: pure-ftpd
Run Code Online (Sandbox Code Playgroud)
有什么问题?
是否有必要做更多的事情?
是否也需要在 /etc/init.d 中创建一个脚本?
小智 46
您还可以运行init-checkconf
检查语法
init-checkconf /etc/init/job.conf
File /etc/init/job.conf: syntax ok
Run Code Online (Sandbox Code Playgroud)
arr*_*nge 27
这通常意味着.conf
文件中有错误- 例如,我不确定pid
10.04 是否支持该节,stop
不能在脚本中使用等。
我想尝试从头开始的文件(只start
,stop
等等),然后慢慢加入越来越多的线,并通过测试它建立起来start pure-ftpd
。
例如:
# cat pure-ftpd.conf
start on filesystem
stop on runlevel S
respawn
respawn limit 10 5
# start pure-ftpd
pure-ftpd start/running
# cat pure-ftpd.conf
start on filesystem
stop on runlevel S
respawn
respawn limit 10 5
pid file /var/run/pure-ftpd.pid
# start pure-ftpd
start: Unknown job: pure-ftpd
Run Code Online (Sandbox Code Playgroud)
Mar*_*erg 26
首先,您可以检查您的工作是否确实是已知的暴发户:
sudo initctl list | grep your_job_name
Run Code Online (Sandbox Code Playgroud)
...your_job_name
您的新贵脚本的名称减去.conf
扩展名在哪里。
如果没有找到,您可以尝试重新加载配置,然后重新检查:
sudo initctl reload-configuration
# re-check
sudo initctl list | grep your_job_name
Run Code Online (Sandbox Code Playgroud)
然后再次尝试开始您的工作:
sudo start your_job_name
Run Code Online (Sandbox Code Playgroud)
如果你不得到任何记录/var/log/daemon.log
或/var/log/syslog
之前,你可能有一些现在。
The most relevant reference for job file syntax will be available when you run the command:
man 5 init
Run Code Online (Sandbox Code Playgroud)
on your system. For Ubuntu 10.04, as you found in the previous answer, the pid file syntax is incorrect.
Any time you get that 'unknown job" error back, its a good idea to check the logs (pre 11.04, /var/log/daemon.log, 11.04 and greater everything goes in /var/log/syslog)
You may see an error like this:
init: /etc/init/test.conf:2: Unknown stanza
Run Code Online (Sandbox Code Playgroud)