punky
August 4th, 2007, 01:39 AM
Basically I have written a shell script, which generates a file. At the beginning of the script I want to remove the last file created by the script, so I use the rm command.
now, when I run the script like ./script.sh the file is deleted. When the script is run by cron, the file isn't. The script still works though.
Anyone know what's going on? I can't see the difference between me running it and cron. I have tried running it via my user and root in cron, but it made no difference.
The only thing it could be, is that when i try and delete the files manually, it comes up with "rm: remove write-protected regular empty file <filename>", which I override with the -f switch in the script, which works (well, when I run it myself)
Many thanx in advance. :)
now, when I run the script like ./script.sh the file is deleted. When the script is run by cron, the file isn't. The script still works though.
Anyone know what's going on? I can't see the difference between me running it and cron. I have tried running it via my user and root in cron, but it made no difference.
The only thing it could be, is that when i try and delete the files manually, it comes up with "rm: remove write-protected regular empty file <filename>", which I override with the -f switch in the script, which works (well, when I run it myself)
Many thanx in advance. :)