Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1901  / 3 Years ago, wed, july 21, 2021, 10:22:15

I made a short script on one server to backup a folder and send it via FTP to another server. I'm trying to set it to run every minute using crontab. It works perfectly when I run it manually, but when cron runs it, nothing appears to happen (i.e. no file received on the other end). As I said in the title, the task shows up in syslog as if everything is A-OK.



Here's the script:



#! /bin/sh

cd /root

FILENAME="backup-$(date +%b_%d_%Y_%H:%M).zip"

zip -r $FILENAME folder

ftp -in 74.131.78.127 24721 << EOF > ~/log.txt 2>&1

user myusername
binary
cd Desktop/backups
mput $FILENAME

EOF

rm $FILENAME


Crontab entry:



* * * * * /root/backup.sh


I entered this using crontab -e.


More From » cron

 Answers
1

I figured out my problem. The actual root did not have permissions to my ineptly named /root folder. A simple chmod -R 707 /root solved it.


[#29811] Friday, July 23, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
arbaour

Total Points: 346
Total Questions: 115
Total Answers: 105

Location: Oman
Member since Wed, Apr 12, 2023
1 Year ago
;