Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # add start script /etc/init.d/iobroker
- echo "############### add start script /etc/init.d/iobroker ###############"
- sudo cat <<- EOF > /etc/init.d/iobroker
- #!/bin/bash
- ### BEGIN INIT INFO
- # Provides: iobroker
- # Required-Start: \$network \$local_fs \$remote_fs
- # Required-Stop: \$network \$local_fs \$remote_fs
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: starts ioBroker
- # Description: starts ioBroker
- ### END INIT INFO
- source /etc/profile
- source /etc/skel/.bashrc
- source /etc/skel/.profile
- (( EUID )) && echo .You need to have root privileges.. && exit 1
- PIDF=/opt/iobroker/node_modules/iobroker.js-controller/lib/iobroker.pid
- #NODECMD=/usr/local/bin/node
- NODECMD=/usr/bin/node
- IOBROKERCMD=/opt/iobroker/node_modules/iobroker.js-controller/iobroker.js
- RETVAL=0
- IOBROKERUSER=iobroker
- # Starting ioBroker
- export IOBROKER_HOME=/opt/iobroker
- echo -n "Starting ioBroker"
- sudo -u \${IOBROKERUSER} \$NODECMD \$IOBROKERCMD start
- EOF
- # add service script /etc/systemd/system/iobroker.service
- echo "############### add service script /etc/systemd/system/iobroker.service ###############"
- sudo cat <<- EOF > /etc/systemd/system/iobroker.service
- #
- # Start ioBroker Daemon
- #
- # /etc/systemd/system/iobroker.service
- # Invoking scripts to start/shutdown ioBroker
- [Unit]
- Description=ioBroker server task
- Requires=network.target
- [Service]
- User=iobroker
- Type=forking
- RemainAfterExit=yes
- Restart=no
- ExecStart=/etc/init.d/iobroker
- [Install]
- WantedBy=multi-user.target
- EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement