- 代碼: 選擇全部
#!/usr/bin/perl
my $PATH = "/home/SVN_Backup";
my $COPYS = 4 ;
my $FILENAME = "SVN-" . "`date +%F`" . ".tar";
system("tar cvf /home/SVN_Backup/$FILENAME /usr/local/SVN_Repository/");
system("bzip2 -f -9 -v /home/SVN_Backup/$FILENAME");
system("chmod 700 -R /home/SVN_Backup");
open(pipe_ls_result, "ls $PATH |") || `echo "SVN Backup Error" >> /var/log/svn_backup.log`;
my @result = <pipe_ls_result> ;
close(pipe_ls_result);
@result = reverse @result;
if($#result >= $COPYS)
{
for( $count = $COPYS ; $count <= $#result ; ++$count)
{
chomp( @result[$count] );
unlink("$PATH/@result[$count]");
}
}
使用 sudo 去跑是正常的,不過放在 /etc/cron.weekly 下之後不會跑,權限是 -rwxr-xr-x ,其他的script 都正常,就只有這個 perl script 不會動,請問一下有可能是什麼問題嗎?謝謝