What's new

Script for removing file

SebZab

Regular Contributor
I want to remove "minidlna.log" file after each reboot of router.
I added "rm" command to post-mount script but it doesn't work:

#!/bin/sh
sleep 2m
/opt/etc/init.d/S95Pyload start
rm -f /tmp/mnt/sda5/media/minidlna/minidlna.log


When I do "rm" command manually in putty it works and remove the file.
What is wrong ?
 
When I do "rm" command manually in putty it works and remove the file.
What is wrong ?

First, I have to ask the obvious (because I often forget myself)....the script is marked as executable and is located in /jffs/scripts ?

Second, try adding some logger commands so you can see in the system log that the script was actually executed and when.

Code:
#!/bin/sh
logger -t  "post-mount" "Started - sleeping"
sleep 2m
logger -t  "post-mount" "Resuming after sleep"
/opt/etc/init.d/S95Pyload start
rm -f /tmp/mnt/sda5/media/minidlna/minidlna.log
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Members online

Back
Top