You are not logged in.
Pages: 1
Using the archstats script listed below, how could I alter the script so that it only runs the $ARCHSTATS_CMD command during boot but not when shutting down? I see that is handled by the 'stop)' section, but I am unclear how to properly remove this portion and still have the script operate as desired.
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
# NOTE: If you use an alternate location for your archstats.conf file,
# make sure to set that accordingly with the -c switch
#
# Set this to the 'archstats' client path
#
ARCHSTATS_CMD='/usr/bin/archstats'
case "$1" in
start)
stat_busy "Updating ArchStats"
if [ -x "$ARCHSTATS_CMD" ]; then
"$ARCHSTATS_CMD" -u
stat_done
else
stat_fail
fi
;;
stop)
stat_busy "Updating ArchStats"
if [ -x "$ARCHSTATS_CMD" ]; then
"$ARCHSTATS_CMD" -u
stat_done
else
stat_fail
fi
;;
*)
echo "usage: $0 {start|stop}"
;;
esac
exit 0
/path/to/Truth
Offline
I would guess this, just remark out the "stop" code. Just add "#" to the start of a line to remark it out, so it does not run.
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
# NOTE: If you use an alternate location for your archstats.conf file,
# make sure to set that accordingly with the -c switch
#
# Set this to the 'archstats' client path
#
ARCHSTATS_CMD='/usr/bin/archstats'
case "$1" in
start)
stat_busy "Updating ArchStats"
if [ -x "$ARCHSTATS_CMD" ]; then
"$ARCHSTATS_CMD" -u
stat_done
else
stat_fail
fi
;;
stop)
# stat_busy "Updating ArchStats"
# if [ -x "$ARCHSTATS_CMD" ]; then
# "$ARCHSTATS_CMD" -u
# stat_done
# else
# stat_fail
# fi
;;
*)
echo "usage: $0 {start|stop}"
;;
esac
exit 0
Offline
stingray, You can't have an empty command, like u can't use
if [ .. ]; then
fi
You have to use
if [ ... ]; then
/bin/true
fi
therefore, it must be
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
# NOTE: If you use an alternate location for your archstats.conf file,
# make sure to set that accordingly with the -c switch
#
# Set this to the 'archstats' client path
#
ARCHSTATS_CMD='/usr/bin/archstats'
case "$1" in
start)
stat_busy "Updating ArchStats"
if [ -x "$ARCHSTATS_CMD" ]; then
"$ARCHSTATS_CMD" -u
stat_done
else
stat_fail
fi
;;
stop)
/bin/true
;;
*)
echo "usage: $0 {start|stop}"
;;
esac
exit 0
[My Blog] | [My Repo] | [My AUR Packages]
Offline
Great, thanks for the help.
/path/to/Truth
Offline
Ok, that makes sense. I've got some experience programming, but bran new to Linux. Working through some of that learning curve. Thanks!
Offline
Offline
Pages: 1