-
Notifications
You must be signed in to change notification settings - Fork 324
How To: Init.d script
Bruno P. Kinoshita edited this page Mar 6, 2021
·
1 revision
Here's an example for an init.d script for Linux-based systems. It also works with systemd.
Create an executable file /etc/init.d/smashing
with following content and adapt the pathes :
#!/bin/bash
### BEGIN INIT INFO
# Provides: dashboard
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
# Must be a valid filename
NAME=smashing
DASHING_DIR=/opt/smashing-dashboards/tvs_dashboard
DAEMON=/usr/local/bin/smashing
PIDFILE="/var/run/smashing.pid"
DAEMON_OPTS="start -d -P $PIDFILE"
GEM_HOME=/var/lib/gems/2.1.0
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
case "$1" in
start)
echo -n "Starting daemon: ${NAME} "
start-stop-daemon --start --quiet --chdir $DASHING_DIR --exec $DAEMON -- $DAEMON_OPTS
echo "."
;;
stop)
echo -n "Stopping daemon: ${NAME} "
start-stop-daemon --stop --quiet --signal 2 --oknodo --pidfile $PIDFILE
echo "."
;;
restart)
start-stop-daemon --stop --quiet --signal 2 --oknodo --retry 30 --pidfile $PIDFILE
start-stop-daemon --start --quiet --chdir $DASHING_DIR --exec $DAEMON -- $DAEMON_OPTS
echo "."
;;
*)
echo "Usage: $1 {start|stop|restart}"
exit 1
esac
exit 0
Then follow instructions of your Linux distribution to enable it
- Home
- Dashing Workshop
- Installation
- Widgets
- Configuration
- Security
- Troubleshooting
- Deploying dashboards
- How Tos
- How to: post data to your dashboard and widgets
- How to: Define a data model and store history data to database
- How to: Prevent a job from overlapping with itself
- How to: Send HTML data to your widgets
- How to: Send mysql data to your widgets
- How to: Setup a Graph
- How to: Store data to and display from database
- How to: Update a Dashboard using a spreadsheet
- How to: update dashboard in Django
- How to: Update font awesome fonts from version 3 to 4
- How to: Use New Relic with Dashing
- How to: precompile assets
- Development