hi I write a simple script,cp it to the /etc/init.d/,then chkconfig it on. the name of the script is "script-tst".
#!/bin/sh ### BEGIN INIT INFO # Provides: ovs-hugepage # Required-Start: # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 #chkconfig 2345 99 99 # Short-Description: hugepage test ### END INIT INFO case "$1" in start) if [ ! -d /var/run/openvswitch ]; then mkdir -m 777 -p /var/run/openvswitch fi /usr/sbin/ovsdb-server /etc/openvswitch/conf.db --remote=punix:/var/run/openvswitch/db.sock --remote=db:Open_vSwitch,Open_vSwitch,manager_options --detach --verbose=info ;; stop) kill -9 `cat /var/run/openvswitch/ovsdb-server.pid` ;; Status) echo "the information you want to display" ;; esac This script can work well when I use the "service script-tst start", but when I restart the server, it cannot start the ovsdb-server. script-tst is the name of the script. the ovsdb-server command and the script-tst is all owned by root. the status after reboot is: [root@ppmaster ~]# systemctl status script-tst -l script-tst.service - LSB: hugepage test Loaded: loaded (/etc/rc.d/init.d/script-tst) Active: failed (Result: exit-code) since Tue 2016-04-26 03:51:17 PDT; 40s ago Process: 676 ExecStart=/etc/rc.d/init.d/script-tst start (code=exited, status=1/FAILURE) Apr 26 03:51:17 ppmaster ovsdb-server[711]: ovs|00002|stream_unix|ERR|/var/run/openvswitch/db.sock: binding failed: No such file or directory Apr 26 03:51:17 ppmaster ovsdb-server[711]: ovs|00003|ovsdb_jsonrpc_server|ERR|punix:/var/run/openvswitch/db.sock: listen failed: No such file or directory Apr 26 03:51:17 ppmaster script-tst[676]: 2016-04-26T10:51:17Z|00004|fatal_signal|WARN|could not unlink "/var/run/openvswitch/ovsdb-server.711.ctl" (No such file or directory) Apr 26 03:51:17 ppmaster script-tst[676]: 2016-04-26T10:51:17Z|00005|stream_unix|ERR|/var/run/openvswitch/ovsdb-server.711.ctl: binding failed: No such file or directory Apr 26 03:51:17 ppmaster script-tst[676]: ovsdb-server: could not initialize control socket punix:/var/run/openvswitch/ovsdb-server.711.ctl (No such file or directory) Apr 26 03:51:17 ppmaster ovsdb-server[711]: ovs|00004|fatal_signal|WARN|could not unlink "/var/run/openvswitch/ovsdb-server.711.ctl" (No such file or directory) Apr 26 03:51:17 ppmaster ovsdb-server[711]: ovs|00005|stream_unix|ERR|/var/run/openvswitch/ovsdb-server.711.ctl: binding failed: No such file or directory Apr 26 03:51:17 ppmaster systemd[1]: script-tst.service: control process exited, code=exited status=1 Apr 26 03:51:17 ppmaster systemd[1]: Failed to start LSB: hugepage test. Apr 26 03:51:17 ppmaster systemd[1]: Unit script-tst.service entered failed state. esac thanks very much! 307419...@qq.com
_______________________________________________ discuss mailing list discuss@openvswitch.org http://openvswitch.org/mailman/listinfo/discuss