We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is a small description for Ubuntu how to create scripts allowing usual start/stop commands including an upstart.
Kill any runnng instances
ps aux | grep redis-stat #get pid from output kill $PID
sudo vi /etc/init.d/redis-stat #fill in following contetnt
#!/bin/sh # # https://www.yzuzun.com/2015/02/monitoring-redis-with-redis-stat/ # ### BEGIN INIT INFO # Provides: redis-stat # Required-Start: $local_fs $remote_fs $network # Required-Stop: $local_fs $remote_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: start Redis Stat (redis-stat) ### END INIT INFO # Defaults RUN_MODE="daemons" # Reads config file (will override defaults above) #[ -r /etc/default/redis-stat ] && . /etc/default/redis-stat PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin NAME="redis-stat" DESC="Redis Stat" DAEMON="/usr/local/bin/redis-stat" DAEMONOPTS="--server" PIDDIR="/var/run/$NAME" PIDFILE="$PIDDIR/$NAME.pid" # clear conflicting settings from the environment unset TMPDIR # See if the daemons are there test -x $DAEMON || exit 0 . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Starting $DESC" # Make sure we have our PIDDIR, even if they're on a tmpfs. install -o root -g root -m 755 -d $PIDDIR if [ "$RUN_MODE" != "inetd" ]; then log_progress_msg "$NAME" if ! start-stop-daemon --start --quiet --oknodo --background --make -pidfile --pidfile $PIDFILE --no-close --startas $DAEMON -- $DAEMONOPTS >> /dev/null 2>&1; then log_end_msg 1 exit 1 fi fi log_end_msg 0 ;; stop) log_daemon_msg "Stopping $DESC" if [ "$RUN_MODE" != "inetd" ]; then log_progress_msg "$NAME" start-stop-daemon --stop --quiet --oknodo --retry 10 --pidfile $PIDFILE # Wait a little and remove stale PID file sleep 1 if [ -f $PIDFILE ] && ! ps h `cat $PIDFILE` > /dev/null then # Stale PID file (process was succesfully stopped). rm -f $PIDFILE fi fi log_end_msg 0 ;; reload) if [ "$RUN_MODE" != "inetd" ]; then log_daemon_msg "Reloading $DESC" start-stop-daemon --stop --quiet --signal HUP --pidfile $PIDFILE log_end_msg 0 fi ;; restart|force-reload) $0 stop sleep 1 $0 start ;; status) status="0" if [ "$RUN_MODE" != "inetd" ]; then status_of_proc -p $PIDFILE $DAEMON $NAME || status=$? fi exit $status ;; *) echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload|status}" exit 1 ;; esac exit 0
Set the upstart
sudo chmod +x /etc/init.d/redis-stat sudo update-rc.d redis-stat defaults
Run the usual service command
sudo service redis-stat start|stop|reload|restart|force-reload|status
The text was updated successfully, but these errors were encountered:
9e89e54
No branches or pull requests
This is a small description for Ubuntu how to create scripts allowing usual start/stop commands including an upstart.
Kill any runnng instances
sudo vi /etc/init.d/redis-stat
#fill in following contetnt
Set the upstart
Run the usual service command
The text was updated successfully, but these errors were encountered: