Skip to content

Instantly share code, notes, and snippets.

@fovtran
Created November 9, 2022 13:23
Show Gist options
  • Save fovtran/fb64283266c1f6a17d64f0f69e5fa9a1 to your computer and use it in GitHub Desktop.
Save fovtran/fb64283266c1f6a17d64f0f69e5fa9a1 to your computer and use it in GitHub Desktop.
feature shell script missing manteinance
#!/bin/sh
### BEGIN INIT INFO
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/xbin/daemon
BNAME=systapper
DESC="Init startup functions"
PIDFILE="/run/$NAME.pid"
DOPTIONS=""
# test -x $DAEMON || exit 0;
# test -f /xbin/default/systapper && . /xbin/default/systapper
test -f /xbin/default/functions && . /xbin/functions.sh
if [ ! -z ${XX_ONESHOT+x} ]; then
DOPTIONS="--oneshot"
fi
case "$1" in
start)
log_begin_msg "Starting $DESC: $NAME"
pid=$( pidofproc -p $PIDFILE $DAEMON )
if [ -n "$pid" ] ; then
log_begin_msg ". Already running"
log_end_msg 0
exit 0
fi
;;
bench)
hdparm -t /dev/sda
;;
smart)
smartctl -a /dev/sda
;;
smarton)
smartctl -s on /dev/sda
;;
smartoff)
smartctl -s off /dev/sda
;;
gpm)
gpm -m /dev/psaux -t ps2
;;
remount)
mount -o remount,rw /opt
mount -o remount,rw /livemounts/local/
/xbin/boot/remounts.sh
;;
wakeup)
/xbin/boot/cpuf-performance.sh
. /xbin/boot/setup-mm.sh
/xbin/boot/worker.sh ro rw
/xbin/boot/confmodules.sh
;;
ifup)
ifup wlp2s0
/xbin/boot/ntpdate-update.sh
;;
ifdown)
ifdown wlp2s0
;;
xorg)
rm -rf /tmp/.ICE-unix/ /tmp/.font-unix/ /tmp/*.cpuprofile /tmp/.XIM-unix/ /tmp/.X11-unix/ /tmp/.X0-lock
;;
status)
status_of_proc $DAEMON $NAME
;;
*)
N=/etc/init.d/$SNAME
echo "Usage: $N {start | bench | smart | smarton | smartoff | gpm | remount | wakeup | ifup | ifdown | xorg | status}" >&2
exit 1
;;
esac
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment