#!/bin/bash
#chkconfig:2345 99 01
#description:wlan_ups
# Source function library.
. /etc/rc.d/init.d/functions
[ -x /wlan/power_protection/check_com ] || exit 0
[ -x /wlan/power_protection/tty_conf_check ] || exit 0
RETVAL=0
exec="/wlan/power_protection_start_script"
prog=$(basename $exec)
start(){
#Check if it is already running
if [ ! -f /var/lock/subsys/wlan_ups ];then
echo -n "Starting wlan_ups daemon service "
daemon $prog
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/wlan_ups
echo
fi
return $RETVAL
}
stop(){
echo -n "Stopping wlan_ups daemon service: "
killproc $prog
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /va/lock/subsys/wlan_ups
}
restart(){
stop
start
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit $RETVAL
(END)
2. 發郵件
#!/bin/sh
ping -c 3 pop.gmail.com
if [ $? -eq 0 ]; then
mail -v -s "my second mail" [email protected] < /project/tan/mail.txt
fi
3. 可以發郵件,播放音樂,發短信的shell腳本
文章出處 : http://guoli0813.blog.51cto.com/623863/127681