Skip to content

Instantly share code, notes, and snippets.

@sherbondy
Last active December 26, 2015 04:39
Show Gist options
  • Save sherbondy/7094713 to your computer and use it in GitHub Desktop.
Save sherbondy/7094713 to your computer and use it in GitHub Desktop.
Flux as a daemon (had trouble getting the gui to work on debian wheezy)
#!/bin/sh
### BEGIN INIT INFO
# Provides: xflux
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Initialize flux on launch
# Description: Flux helps you to avoid eye and disrupted sleep patterns strain by adjusting your display colors based on time of day.
### END INIT INFO
#
#Daemonized flux for my zip code
#
ZIP=02139
PID=$(pgrep "xflux"| head -n 1)
case "$1" in
start|"")
if [ -z "$PID" ]
then
xflux -z $ZIP
else
echo "flux is already running: $PID"
fi
;;
stop)
if [ -z "$PID" ]
then
echo "flux is not running."
else
kill $PID
fi
;;
*)
echo "Usage: xflux.sh [start|stop]"
exit 3
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment