시작시 응용 프로그램을 실행하면됩니다. 그래서 나는 그것을 봉사로 만들었다. 즉 /etc/init.d 아래 쉘 스크립트로. 우분투를 사용하고 있습니다 .. 문제는 내가 존재하지 않는 경우/var/run 디렉토리 아래에 폴더를 만들어야한다는 것입니다. 다음은 내 코드입니다.쉘 암호로 디렉토리를 생성하고 시스템 시작시 실행 가능하게하는 스크립트
#!/bin/sh
set -e
start() {
if [ -d "/var/run/bucardo" ]; then
echo "Directory Exists"
echo -n "Starting bucardo: "
sudo bucardo_ctl start
echo "done."
else
echo "Creating Directory"
sudo mkdir /var/run/bucardo
echo -n "Starting bucardo: "
sudo bucardo_ctl start
echo "done."
fi
}
stop() {
echo -n "Shutting down bucardo: "
sudo bucardo_ctl stop
echo "done."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 10
start
;;
*)
esac
exit 0
그래서 응용 프로그램의 기본 폴더 인/var/run 아래에 폴더를 만듭니다.
쉘 스크립트에 암호가있는 폴더를 만들려면 어떻게해야합니까? 그래서 내가 폴더를 확인하고 그것을 만들 수 있습니다.
다음은 시작시 스크립트를 실행했을 때의 오류입니다. 나는
insserv: warning: script 'K01centrifyda' missing LSB tags and overrides
insserv: warning: script 'K01cups' missing LSB tags and overrides
insserv: warning: script 'K01acpi-support' missing LSB tags and overrides
insserv: warning: script 'bucardo' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'hwclock-save' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `hwclock-save'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `hwclock-save'
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'ufw' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `ufw'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `ufw'
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'lightdm' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `lightdm'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `lightdm'
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'acpid' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `acpid'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `acpid'
insserv: warning: script 'centrifyda' missing LSB tags and overrides
insserv: warning: script 'adnisd' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'binfmt-support' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `binfmt-support'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `binfmt-support'
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'plymouth-splash' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `plymouth-splash'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `plymouth-splash'
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'network-interface' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `network-interface'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `network-interface'
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'plymouth-log' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `plymouth-log'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `plymouth-log'
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'alsa-restore' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `alsa-restore'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `alsa-restore'
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'procps' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `procps'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `procps'
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'udevtrigger' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `udevtrigger'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `udevtrigger'
insserv: warning: script 'cups' missing LSB tags and overrides
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'setvtrgb' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `setvtrgb'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `setvtrgb'
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
insserv: warning: script 'udev' missing LSB tags and overrides
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `udev'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `udev'
The script you are attempting to invoke has been converted to an Upstart
job, but lsb-header is not supported for Upstart jobs.
매우 긴 ... 미리 ... 감사합니다 제발 도와주세요 .. 오류는 이어 "chkconfig를 --level 234 bocardo"
그것을 할 다음 명령을 사용 .. 다음 피터의 제안 사항에 따라
.. 는 http://jonathonhill.net/2009-04-23/auto-start-a-shell-script-on-ubuntu-server/
누구든지 투표를 통해 다음 번에 수정할 수있는 이유를 알려주십시오. –