strong.s@crwash.org
2006-Feb-23 20:06 UTC
[Nut-upsuser] making upsd available to chkconfig
OK, so I made this file: ------------------------------------------ #!/bin/sh<\n> #chkconfig: 2345 60 99 #description: NUT ups daemon if [ ! -f /usr/local/ups/bin/upsd ] then echo "NUT startup: cannot start" exit fi case "$1" in "start") chmod 0600 /proc/bus/usb/005/002 chown nut:nut /proc/bus/usb/005/002 /usr/local/ups/bin/upsdrvctl /usr/local/ups/sbin/upsd /usr/local/ups/sbin/upsmon ;; "stop") echo -n "Shutting down UPS monitoring:" /usr/local/ups/sbin/upsmon -c stop /usr/local/ups/sbin/upsd -c stop /usr/local/ups/bin/upsdrvctl stop ;; "restart") $0 stop sleep 15 $0 start "status") /usr/local/ups/bin/upsc gretchen@stretch *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac ----------------------------------------- and saved it as: /etc/init.d/upsd and made it executable: chmod 755 /etc/init.d/upsd -- but left the owner and group as root and then added it to the chkconfig system: chkconfig --add upsd and made sure it will be run at statup: chkconfig --levels 2345 upsd on I checked to make sure the commands in the file worked correctly when run from the command line logged in as root and I checked to make sure that the levels got set right. BUT... it doesn't run correctly on start up and when I execute any of these lines from the command line: service upsd start service upsd retart service upsd stop service upsd status I get the same error: env: /etc/init.d/upsd file not found any ideas??? Thanks and an appology to Pete Selinger, who suffered through me replying to him instead of to the list!!! steve
strong.s@crwash.org wrote:> > OK, so I made this file: > ------------------------------------------ > #!/bin/sh<\n>That is a syntax error. The file that was not found is "/bin/sh<\n>". Presumably this should be "#!/bin/sh".> I get the same error: > > env: /etc/init.d/upsd file not found > > any ideas??? > > Thanks and an appology to Pete Selinger, who suffered through me > replying to him instead of to the list!!!:) -- Peter