-When using Services->System->User, Submit, the error "user_proc.cgi: line 30: syntax error:..."error message is displayed. Fix: https://groups.google.com/d/msg/alt-f/irB51Q01Yvs/S5RecQA7AQAJ
I am trying to run the following script via /mnt/sda2/boot.sh (loaded under user)#!/bin/shsleep 90/mnt/sda2/Alt-F/opt/sbin/apcupsd /opt/etc/apcupsd/apcupsd.conf
echo "Yes, it works" > /tmp/foobar
#!/bin/sh# Script to execute as the root user at boot time.# You can loose your data or make the system inaccessible# if using the wrong commands. You have been warned!exec >> /var/log/user.log 2>&1case "$1" instart)echo "Starting $0";;stop)echo "Stopping $0";;esac
It does seem that the user script is executing at boot however apcupsd is buggy and won't execute, so that, puts the project to a halt.
thank you.
I decided to give NUT another spin. The Alf-F package (nuts) is missing a lot of dependecies and the driver for the apcupsd.
I decided to give NUT another spin. The Alf-F package (nuts) is missing a lot of dependecies
and the driver for the apcupsd.
I was able however to connect the Entware-ng nut packge (2.7.4-4) with the apcupsd driver (nut-driver-apcupsd-ups 2.7.4-4) and after configuring it, i was able to read the raspberry pi apcups network output (thus establishing a UPS monitor on the Alt-F).I am however facing the same issue with the user script.It fails to execute the daemons for some reason.here is my current script#!/bin/sh
# Script to execute as the root user at boot time.# You can loose your data or make the system inaccessible# if using the wrong commands. You have been warned!
#!/bin/sh
# Script to execute as the root user at boot time.
# You can loose your data or make the system inaccessible
# if using the wrong commands. You have been warned!
exec >> /var/log/user.log 2>&1
case "$1" in
start)
/etc/IOSpush.pl -apikeyfile=/etc/api_key.txt -event="MezelNAS2" -notification="Powered on and ready."
;;
stop)
echo "Stopping $0"
;;
esac
I decided to give it one more try to see exactly how this works and IF it works.
I have it enabled, with the following code inside:#!/bin/sh
# Script to execute as the root user at boot time.
# You can loose your data or make the system inaccessible
# if using the wrong commands. You have been warned!
exec >> /var/log/user.log 2>&1
case "$1" in
start)
/etc/IOSpush.pl -apikeyfile=/etc/api_key.txt -event="MezelNAS2" -notification="Powered on and ready."
;;
stop)
echo "Stopping $0"
;;
esacNow, the notification works, i always receive it reboot/shutdown regardless on how i do it. Either via the webpage or console. As soon as I issue the command, the user script gets triggered and it sends me the notification.It never happens on boot.It seems that the user script is triggered the other way around ... Can someone confirm ?
[root@DNS-325]# ls -l /tmp/lock/userscript-rw-r--r-- 1 root root 0 May 18 18:40 /tmp/lock/userscript
[root@DNS-325]# grep USER_SCRIP /etc/misc.confUSER_SCRIPT="/mnt/sda4/startup.sh"
#!/bin/sh
exec >> /var/log/user.log 2>&1
case "$1" in
start)
waitfor="md1 sda4 sdb3"
for i in $waitfor; do
echo -n "waiting for $i:"
while ! mountpoint -q /mnt/$i; do
echo -n '.'
sleep 5
done
echo OK
done
echo -n "Waiting for aufs.sh to finish:"
while ! aufs.sh -s >& /dev/null; do
echo -n '.'
sleep 1
done
# FIXME: full path with /Alt-F/ might be needed
#if test $(uname -r) = 3.18.28; then
# ethtool -K eth0 tso off
#fi
cp -a /mnt/sda4/.ssh /root
echo OK
;;
end)
;;
esac
L.E. log states that the file is not found.I even placed the direct path to the file./mnt/sda2/boot.sh: line 16: /mnt/sda2/Alt-F/etc/IOSpush.pl: not found/mnt/sda2/boot.sh: line 16: /etc/IOSpush.pl: not found
while ! aufs.sh -s >& /dev/null; do
echo -n '.'
sleep 1
done
I used the
while ! aufs.sh -s >& /dev/null; do
echo -n '.'
sleep 1
doneSo much cleaner than a timer.
#!/bin/sh
# this script will terminate after 10 seconds maximum# or earlier when the tasks terminate
TMOUT=10
mainpid=$$(sleep $TMOUT; kill -USR1 $mainpid) &watchdogpid=$!
reason () { echo "sorry, timeout" exit 1}
trap reason USR1
# a count loop, replace by your tasks: cnt=15 # replace with 5 to terminate with successwhile test $((--cnt)) != 0; do echo $cnt sleep 1done# end of tasks
kill $watchdogpid
echo "job done"exit 0