PDA

Bekijk de volledige versie : Start own script in post-boot or post-firewall



m-h-l
29-09-2005, 19:42
Hi,

(on a WL-500g with Olegs last firmware v1.9.2.7 CR6b)

I have the idea to start a script in the post-firewall or post-boot
(/usr/local/sbin/...) script

with the commands:


#!/bin/sh
if [ -e /tmp/harddisk/autochk.sh ]; then
/tmp/harddisk/autochk.sh &
fi


which should run in the background and checks if a special
file is copied to the ftp_pub directory.
If this file was found it should be executed ... for example to:
- download a file from the internet or to
- send a wakeup frame to the server in the LAN.

After execution it should be deleted.

The autochk.sh looks like this:


#!/bin/sh
cd /tmp/harddisk/ftp_pub/
sleep 63
while [ 1 ] ; do
sleep 63
if [ -e /tmp/harddisk/ftp_pub/command.txt ]; then
echo Execute /tmp/harddisk/ftp_pub/command.txt
chmod -x /tmp/harddisk/ftp_pub/command.txt
. /tmp/harddisk/ftp_pub/command.txt

printf "subject:Router-Feedback\nto:xyz@arcor.de\nscript finished\n`date`\n`more /tmp/harddisk/ftp_pub/xyz.txt`\n" | mini_sendmail -v -t -fxyz@arcor.de -smail.arcor.de xyz@arcor.de

rm /tmp/harddisk/ftp_pub/KOMMANDO.txt

fi
done



But if I add this script to post-firewall it seems it will not be started
(I can't see it with 'top' or 'ps -f') but if I start it by hand (via telnet)
then it works like expected.

Now the questions :D :

1. Can I start an own script in one of these files (post-boot or post-firewall) or why not?

2. If I start it with '&' at the end ... is it really running in an own process without influencing anything else?

3. Do I have to expect any trouble with the router if I do this (like: not enough ram, to slow etc.)

Thx

Markus

Styno
29-09-2005, 20:12
Do not use post-firewall or post-boot for this, but post-mount instead. The script does not start because the partition isn't mounted yet and therefore the file doesn't exist.

m-h-l
30-09-2005, 19:03
Thats it, thx, now it works

Is there somewhere a list with all possible post-XXX scripts?

Cheers,
Markus