How to Schedule backups with a cron job

Category: Tools

AndreasKoug
Asked:
2012-05-27 4:45 pm EST

Hits: 1,565
Hello, I need to scedule a daily backup with cronjob.

I have created file backup.sh with this content:
_________________________________________________________________________
#!/bin/sh

wget -O /dev/null -q –http-user=$1 –http-password=$2 http://localhost:2082/frontend/x3/backup/dofullbackup.html –post-data=”dest=homedir&email=$3&email_radio=1&user=$1&pass=$2″
_________________________________________________________________________

and a cronjob with this command:
lynx -dump -useragent=/home/myUserName/backup.sh “myUserName” “myPassword” “myEmailAddress”
I also tryed:
lynx -dump -useragent=lynx(/home/myUserName/backup.sh) myUserName myPassword myEmailAddress

I got an email on the corect time, with the following message:
_________________________________________________________________________

/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `lynx -dump -useragent=lynx(/home/myUserName/backup.sh) myUserName myPassword myEmailAddress
_________________________________________________________________________

and an other one, with previus tests with the following message:
_________________________________________________________________________

Warning: User-Agent string does not contain "Lynx" or "L_y_n_x"!

Alert!: User-Agent string does not contain "Lynx" or "L_y_n_x"
Can't Access `file://localhost/home/myUserName/myEmailAddress
Alert!: Unable to access document.

lynx: Can't access startfile
_________________________________________________________________________

What is the correct syntax to make it work?
Thank you!

You must login before you can ask a follow up question.

You must login before you can submit an answer.

OTHER ANSWERS

0

BradM
Staff
2,770 Points
2012-05-29 9:11 am EST
Hi AndreasKoug,

What is the correct syntax to make it work?

I don't have a script readily available for you to backup your account via a cron job, but I'd be happy to help troubleshoot some of the error messages that you are receiving.

line 0: syntax error near unexpected token `('

Sometimes code doesn't paste correctly when asking a question here in Community Support. Can you post a copy of your script to pastebin so we can test a little further? Be sure to post a comment at the bottom of his page with a link to your code.

Warning: User-Agent string does not contain "Lynx" or "L_y_n_x"!

Have you tried setting your user agent to Lynx instead of lynx(/home/myUserName/backup.sh)?

I have created file backup.sh with this content:

Before attempting to setup the cron, have you first verified that your backup.sh file is working correctly? If you are on a VPS or Dedicated server, you can SSH into your account and run your script. Once you know that is working correctly, then you can focus on the syntax of the cron.

Again, feel free to post a comment at the bottom of this page with more details, and we'll be happy to assist further.

Thanks,
- Brad

You must login before you can post a comment about this answer.

Like this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!