UpStartã«ãªã£ã¦ã¤ãã¤ãå¤ããã¾ãããã©ã®è¾ºãå¤ãã£ãã®ãã調ã¹ã¦çºãã¾ãã
/etc/init.d ããç¡ããªãã¾ãã
/etc/init.d/mysqlãã¡ã¤ã«ã¯ç¡ããªãã¾ããã
Upstart 以å
-rwxrwxrwx 1 root root 21 2011-05-06 02:35 mysql
UpStart 以é
lrwxrwxrwx 1 root root 21 2011-05-06 02:35 mysql -> /lib/init/upstart-job #ãªã³ã¯ã«
UpStartã«ãªãã¨ã /etc/init.d/XXX ã®ã¹ã¯ãªããã¯ã /lib/init/upstart-job ã«æ¸ãæãã£ã¦ãã¾ããã
/etc/init.d/mysql ã¯ãã³ã«ç§»åããã®ã
/etc/init.d/ãâ/etc/initã«ç§»åãã¾ãã*1
Upstart 以å | /etc/init.d/mysql |
---|---|
Upstart 以é | /etc/init/mysql.conf*2 |
**ubuntuã¨fedra ã§è¥å¹²éãã
upstartã§è¿½å ãããã³ãã³ã
Upstartã«ãªã㨠/sbin ã«æ¬¡ã®ã³ãã³ãã追å ããã¾ãã
- status
- ç¶æ 表示
- start
- èµ·å
- stop
- åæ¢
- restart
- åèµ·å
ãã³ãã³ãç»é²ããã
takuya@atom:~$ sudo stop smbd #stop ä¾ smbd stop/waiting takuya@atom:~$ sudo start smbd #start ä¾ smbd start/running, process 9513 takuya@atom:~$ sudo reload smbd #reload ä¾ takuya@atom:~$ sudo restart smbd smbd start/running, process 9525 #restart ä¾ï¼PIDãå¤ãã£ã¦ãããï¼
restart ã³ãã³ã㯠reboot ã³ãã³ãã¨ééãããã§æããã
upstart ã§ç®¡çããã¦ããä¸è¦§
upstart ã§ç®¡çããã¦ããä¸è¦§ã¯ãinitctl ã³ãã³ãã§è¦ããã¨ãã§ãã¾ã
ã³ãã³ãä¾
ï¼Mysqlãç»é²ããã¦ããã調ã¹ã¦ã¿ã¾ãã)
takuya@attn02:~$ sudo initctl list | grep mysql mysql start/running, process 1274
initctl ã¯æ ¹æ¬ãã¼ã«ããã
initctl 㯠/etc/init.d/ ã®ä»£æ¿ã³ãã³ãã®å
¨ã¦ã®åºæ¬ã«ãªããã¼ã«ã®ããã§ãã
{start,reload,stop,restart,status} ã®ã³ãã³ãã¯å
¨ã¦ initctl ã«ç´ã¥ãããã¦ãã¾ããã
takuya@atom:~$ ls -l /sbin/{start,reload,stop,restart,status} lrwxrwxrwx 1 root root 7 2011-05-06 02:11 /sbin/reload -> initctl lrwxrwxrwx 1 root root 7 2011-05-06 02:11 /sbin/restart -> initctl lrwxrwxrwx 1 root root 7 2011-05-06 02:11 /sbin/start -> initctl lrwxrwxrwx 1 root root 7 2011-05-06 02:11 /sbin/status -> initctl lrwxrwxrwx 1 root root 7 2011-05-06 02:11 /sbin/stop -> initctl
initctl ã®ä½¿ãæ¹
ã§ã¯ initctl ã¯ã©ããªãã®ãè¦ã¦ã¿ã¾ãã
takuya@atom:~$ sudo initctl help ã¸ã§ã commands: start Start job. stop Stop job. restart Restart job. reload Send HUP signal to job. status Query status of job. list List known jobs. ã¤ãã³ã commands: emit Emit an event. Other commands: reload-configuration Reload the configuration of the init daemon. version Request the version of the init daemon. log-priority Change the minimum priority of log messages from the init daemon show-config Show emits, start on and stop on details for job configurations. check-config Check for unreachable jobs/event conditions. help display list of commands
initctl ã start ãåã
ããã¾ã§ããµã¾ãã¦ã次ã®ï¼ã³ãã³ãã¯åãæå³ã«ãªãããã§ãã
ã» start mysql ã» initctl start mysql ã» /etc/init.d/mysql start
以ä¸ã¯åãã§ãã
init.d ã使ã£ã¦ããç§ã¯
/etc/init.d/mysql ã initctl mysql ã«å¤ãã£ã
ã¨è³å ç½®æã§è¦ãããã¨ã«ãã¾ããã
èµ·åã¹ã¯ãªããã®æ¸ãæ¹ã¯å¤ãã£ãã®ï¼
/etc/init.d/ ã®èµ·åã¹ã¯ãªããã¯ãã®ã¾ã¾ä½¿ãã¾ããã
èµ·åã¹ã¯ãªããã®æ¸ãæ¹ãå¤ããã¾ããã
Upstart 以å | ã·ã§ã«ã¹ã¯ãªãã #/bin/sh ãåºæ¬ |
---|---|
Upstart 以é | UpStart ç¨DSL ï¼å°ç¨ã³ãã³ãï¼ã·ã§ã«ã¹ã¯ãªãããè¨è¿°ããæãï¼ |
SSHdã®èµ·åè¨å®ãã¡ã¤ã«ã®å ´å
SSHd ã®å ´åã®èµ·åè¨å®ã¯æ¬¡ã®ãããªæãã«ãªã£ã¦ããã
/etc/init/以ä¸ã®ãã¡ã¤ã«ãããã¤ãçºããã°æè¦ã¯ã¤ãããã¨æã
1 # ssh - OpenBSD Secure Shell server 2 # 3 # The OpenSSH server provides secure shell access to the system. 4 5 description "OpenSSH server" 6 7 start on filesystem or runlevel [2345] 8 stop on runlevel [!2345] 9 10 respawn 11 respawn limit 10 5 12 umask 022 13 14 pre-start script 15 test -x /usr/sbin/sshd || { stop; exit 0; } 16 test -e /etc/ssh/sshd_not_to_be_run && { stop; exit 0; } 17 test -c /dev/null || { stop; exit 0; } 18 19 mkdir -p -m0755 /var/run/sshd 20 end script 21 22 # if you used to set SSHD_OPTS in /etc/default/ssh, you can change the 23 # 'exec' line here instead 24 exec /usr/sbin/sshd -D
Samba ã® smbd èµ·åè¨å®ã®å ´å
1 description "SMB/CIFS File Server" 2 author "Steve Langasek <[email protected]>" 3 4 start on (local-filesystems and net-device-up) 5 stop on runlevel [!2345] 6 7 respawn 8 9 pre-start script 10 RUN_MODE="daemons" 11 12 [ -r /etc/default/samba ] && . /etc/default/samba 13 14 [ "$RUN_MODE" = inetd ] && { stop; exit 0; } 15 16 install -o root -g root -m 755 -d /var/run/samba 17 end script 18 19 exec smbd -F
mysqlã¯ä¸ç®ã§ãããã«ããã£ãããªã®ã§SSHD/smbd ããµã³ãã«ã§ç´¹ä»ãmysql ã¯Debianç¬èªè¨å®ãå¤ããã ã»ã»
è¨å®ãã¡ã¤ã«ã®ãã¤ã³ã
UpStartã¯ãinit.dã®ååé ã®èµ·åã§ã¯ãªãï¼ã¤ãã³ãæã«èµ·åããããã«ãªã£ã¦ããã
ã¤ãã³ãã¯èªç±ç»é²å¶ã§
starton XXX
ã¨è¨è¿°ãã¦ç»é²ãããå®éã«ä»¥ä¸ã®ããã«ä½¿ããã¦ãã
7 start on filesystem or runlevel [2345] #sshd 4 start on (local-filesystems and net-device-up) #samba
ã¤ãã³ãã¨ã©ã³ã¬ãã«ç®¡çã以åã¨å¤ãã£ãã®ã§UpStartç¥ããªãã¨è¿½ããããããªãã
以åã¯ãã¡ã¤ã«ã¨ãã£ã¬ã¯ããªè¦ãã°å¤§ä½åãã£ããã ãã©ãã
æå¾ã« upstart ã®è¦åãæ¶ãæ¹æ³
以åã®ããã« /etc/init.d/mysql start ãå©ãã¨
Since the script you are attempting to invoke has been converted to an Upstart job, you may also use the start(8) utility, e.g. start mysq
Upstartã«å¤ãã£ããã /etc/init.d 使ããªãã§ããã£ã¦åºã¦ãã¾ãã
ããããã©ãããã®ã§ãæ¶ãããã¨æãã¾ãããã®ã¡ãã»ã¼ã¸ã¯ã·ã§ã«ã¹ã¯ãªããã§æ¸ããã¦ãã¦ã
ãã§ãã¨å¤ããã°ç°¡åã«æ¶ããã¨ãã§ãã¾ãã
31 32 if [ -z "$DPKG_MAINTSCRIPT_PACKAGE" ]; then 33 #ECHO=echo # echo ã³ãã³ããã³ã¡ã³ãã¢ã¦ã 34 ECHO=: # echoã³ãã³ãã®ä»£ããã«ä½ãããªãæãã«ããã» 35 else 36 ECHO=: 37 fi
ããã ãã§ãã$DPKG_MAINTSCRIPT_PACKAGE ãã¡ããã¨è¨å®ãã¦ãè¯ããã§ããé¢åã§ãããã
upstart ã£ã¦
便å©ã«ãªã£ãã¯ããªãã ãã©ããã¡ã¤ã«ã¨ãã©ã«ãè¦ã¦ãã°å¤§ä½åãã£ãã®ã«æ¯ã¹ãã¨å¤§åä¸ä¾¿ã
CentOS/Fedoraãªäººã¯ chkconfg ãã¦ãããéåæãªãã®ã ãããã©ã
upstart ã§èªé ãå¤ãããã¨ãéè¦ãªãã ãããã¨æ¶æ¸¬
/etc/init.d/mysql start # æ¥æ¬èªçãªèªé initctl start mysql # è±èªçãªSVOèªé
ç±³å½äººã«ã¯ï¼ mysql start ã¨æ¥æ¬èªçãªèªé ãç¸å½ãªéåæã ã£ããã ãªã¨æãããã§ãã