Skip to main content

Thread: Cron Job Ubuntu v10.10 HELP...


hello,

can't figure out why #bin/bash command when called via cron not copy folders/files if run same executable file given directory.

example: cd folders > run ./budgetbak ---executable runs , copies folders/files

however, when scheduling crontab to path of budgetbak executable stored, cron job runs successfully, folders/files not included.

i've tried under both root , scheduling job under tool called "schedule tasks". receive same result no folders/files included.

below example of simple #!bin/bash script

#!/bin/bash
#backupscript
# backup budget directory backupfolder

# tar & gzip each directory
tar -czvf /home/useraccount/documents/budget.tar.gz budget

#move tar.gz file specefic directory
mv /home/useraccount/documents/budget.tar.gz /home/nate/backupfolder

# output file date & time of backup
echo "moved folders- completed successful on $(date)" >> /home/useraccount/backupc$

#output information .txt file
echo "tar completed on $(date)" >> /home/useraccount/backupcompleted.txt
#space between each run
echo "################################################# ##############" >> /home$

sample of crontab configuration:

#backup budget folder
#*/01 * * * * /home/useraccount/documents/budgetbak

input appreciated!

i think main issue script when generates tar.gz file. typically run script location script being run, cron not that. cron looking "budget" cannot find , script fails.

since know directory budget exists, , doesn't change, hard code path in script so:

code:
tar -czvf /home/useraccount/documents/budget.tar.gz /path/to/budget
now cron shoud not have problem finding budget folder.


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [ubuntu] Cron Job Ubuntu v10.10 HELP...


Ubuntu

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support