|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Shell Script Permissions Issue
I've been having problems with LogRotate, so while I troubleshoot them, I've written a little shell script to rotate my qmail scanner log.
Code:
#!/bin/bash LOGFILE=/var/spool/qmailscan/qmail-queue.log tar -cvvf ~/qmail-queue.backup.tar.gz $LOGFILE echo "" > $LOGFILE Code:
#rotate logs every saturday at 12am 0 0 * * * /var/qmail/bin/qmail-queue-log-rotate.sh 2> /dev/null Quote:
|
|
#2
|
||||
|
||||
|
what user is running the script? Is it root?
If not, you need to do whatever your distro wants, sudo or equivalent |
|
#3
|
|||
|
|||
|
Quote:
|
|
#4
|
||||
|
||||
|
can you execute the commands by hand as root?
You could have 444 or some equivalent protection that does not allow root to write |
|
#5
|
|||
|
|||
|
I changed the permissions, now I don't get "permission denied", here's the output:
Quote:
Last edited by Weekend Coder : May 3rd, 2008 at 01:30 PM. |
|
#6
|
||||
|
||||
|
Do you really have it
Quote:
rather than something like tar -cvzf create verbose gZip file |
|
#7
|
|||
|
|||
|
Quote:
|
|
#8
|
||||
|
||||
|
I just did. Your upthread posting says
Quote:
which does not work for me. you are missing the z, instead you have to v Quote:
Before you try to debug a shell script, make sure that the commands work manually |
|
#9
|
|||
|
|||
|
Oh, I see. Also, I changed the tilde (~).
Quote:
|
|
#10
|
|||
|
|||
|
I was wondering about that; the ~ tilde represents the user's home directory, in this case I suppose it would be /root.
I recommend using the full path to the file when using scripts like this, especially in conjunction with cron.
__________________
BookMooch.com : Give books away. Get books you want. |
|
#11
|
||||
|
||||
|
yes, ~ in cron scripts can be confusing. Much more obvious to be explicit
|
![]() |
| Viewing: Dev Shed Forums > Operating Systems > Linux Help > Shell Script Permissions Issue |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|