Newbie's problems understanding how Cron works

Newbie's problems understanding how Cron works

Postby Fuddyduddy » Wed Sep 03, 2014 7:02 pm

Hello

I've just embarked on my first-ever use of Cron, and would much appreciate one or two tips.

I invoked Cron via the 'Backup' tab under the 'User Account' menu (having first followed the instruction in 'Help' to create a Cron user-account). I did so after having executed two backups and afterwards clicking on the "Add scheduled backup in Cron" button. I then went to the 'Cron scheduler' menu and on the 'Schedule Servers' page scheduled a regular repetition of one of the backups, selecting 'Day' and 'Every(*)', in steps of three units.

All this being totally new to me I don't know whether my intuitive choices made sense or not. Anyway, I ended up with on the 'Setup' tab a Cron job in the jobs list and Cron Scheduler enabled (and with "activate Cron at each boot" ticked).

Looking into the 'Cronjobs' folder I find that it's creating a log-file at one-minute intervals(!) which I'm sure can't be the intention since each successive one shows nothing whatever to have changed (which of course nothing should have yet).

Could someone kindly guide me as to how I should change my settings, which I presume must be wrong.

TIA.
Fuddyduddy
Donator VIP
Donator VIP
 
Posts: 162
Joined: Thu Mar 14, 2013 9:00 am
Location: Åland Islands

Re: Newbie's problems understanding how Cron works

Postby Jocko » Thu Sep 04, 2014 8:47 am

Hi Fruddyduddy,

Several points are not clear for me.

Fuddyduddy wrote:I invoked Cron via the 'Backup' tab under the 'User Account' menu (having first followed the instruction in 'Help' to create a Cron user-account).
Why did you create a Cron user-account?
A rsync user account is required only if you want to make backups by using the rsync server from a remote host. If your hosts are available from your LAN, encrypting your backups is useless.
I did so after having executed two backups and afterwards clicking on the "Add scheduled backup in Cron" button. I then went to the 'Cron scheduler' menu and on the 'Schedule Servers' page scheduled a regular repetition of one of the backups, selecting 'Day' and 'Every(*)', in steps of three units.
May be a misunderstanding. The 'Schedule Servers' menu must be used only for start or stop some servers like media servers or FTP.

To manage the other cron jobs, you must use the main cron menu (setup menu) : to edit some existing jobs or create new jobs.
I then went to the 'Cron scheduler' menu and on the 'Schedule Servers' page scheduled a regular repetition of one of the backups, selecting 'Day' and 'Every(*)', in steps of three units.
Could you post the related job line because I don't understand well.
Note: when you edit or add a new job, you have information with the help menu
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Newbie's problems understanding how Cron works

Postby Fuddyduddy » Thu Sep 04, 2014 12:50 pm

Hi Jocko
Jocko wrote:Note: when you edit or add a new job, you have information with the help menu
Believe it or not I tried to follow the help menu. With hindsight it's all too obvious that I misunderstood it pretty comprehensively :doh
Several points are not clear for me.

Fuddyduddy wrote:I invoked Cron via the 'Backup' tab under the 'User Account' menu (having first followed the instruction in 'Help' to create a Cron user-account).
Why did you create a Cron user-account?
In fact I didn't; what I meant to say was that I created a Cronjob share, and that I did so because 'Help' says the "Add scheduled backup in CRON" button isn't activated otherwise.
Fuddyduddy wrote: I did so after having executed two backups and afterwards clicking on the "Add scheduled backup in Cron" button. I then went to the 'Cron scheduler' menu and on the 'Schedule Servers' page scheduled a regular repetition of one of the backups, selecting 'Day' and 'Every(*)', in steps of three units.
May be a misunderstanding. The 'Schedule Servers' menu must be used only for start or stop some servers like media servers or FTP.
To manage the other cron jobs, you must use the main cron menu (setup menu) : to edit some existing jobs or create new jobs.
I hadn't appreciated that. I was attempting (wrongly it seems) to use it to schedule regular repeats, at 3-day intervals, of each of the two backups I had previously made so as to keep the source folder and the destination folder in sync.
Fuddyduddy wrote: I then went to the 'Cron scheduler' menu and on the 'Schedule Servers' page scheduled a regular repetition of one of the backups, selecting 'Day' and 'Every(*)', in steps of three units.
Could you post the related job line because I don't understand well.
Here's a copy
Code: Select all
/usr/bin/php '/share/1000/cronjobs/Rsync_USB-NAS_backup_1.from.Recorded_TV_6CO5o9.php' >>/share/1000/cronjobs/cron.log
As far as I remember this line was generated as the job line on the "Schedule Servers" page
Fuddyduddy
Donator VIP
Donator VIP
 
Posts: 162
Joined: Thu Mar 14, 2013 9:00 am
Location: Åland Islands

Re: Newbie's problems understanding how Cron works

Postby Jocko » Thu Sep 04, 2014 1:30 pm

Ok Fuddyduddy,

I confirm that you must not use the 'Schedule Servers' menu.
(otherwise it would be a bug but I just checked it and it is the add jobs menu from the main menu that is used).

I was not enough clear about the job line. I wanted the full cron job line and not only the shell command used.

So could you post again your job line (after clicking on 'Generate job line') like this
Code: Select all
0 0 * * * /usr/bin/php '/share/1000/cronjobs/Rsync_USB-CleExt4_1.from.firwareslut_fZdXtN.php' >>/share/1000/cronjobs/cron.log
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Newbie's problems understanding how Cron works

Postby Fuddyduddy » Thu Sep 04, 2014 2:50 pm

Jocko

I'm sorry to be dense but I don't understand what steps to follow.

All I seem to have succeeded in doing now is deleting the cronjob which I had set up! So now I imagine it's no longer retrievable.
Fuddyduddy
Donator VIP
Donator VIP
 
Posts: 162
Joined: Thu Mar 14, 2013 9:00 am
Location: Åland Islands

Re: Newbie's problems understanding how Cron works

Postby Jocko » Thu Sep 04, 2014 7:37 pm

Don't worry Fuddyduddy,

To plan a backup you must follow these steps:
- Use the backup menu to select source, destination and backup option.
- Then, click on the button 'Add Scheduled Backup in CRON'. This opens the add job menu.
- here, you must select the date time for the backup (use the five dropdown lists)
- you can also add a comment to help you for managing the several jobs.
- So to save the job, you must first click on the button 'Generate Job Line'. This allows you to get the full cron job line (as asking in my previous post) then click on the accept button.

Now you must have a new line in the cron job table. To edit this job, click on the related link (in the last right column)


So with these explanations, please do again what you did and post the cron job line and explain what you want.

With these i will be able to give more details how to set the datetime for a job.
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Newbie's problems understanding how Cron works

Postby Fuddyduddy » Fri Sep 05, 2014 9:51 am

Hi Jocko

Thanks a lot.

I'll follow the steps as you set them out, and will be in touch again when I have the new cronjob line to post.
Fuddyduddy
Donator VIP
Donator VIP
 
Posts: 162
Joined: Thu Mar 14, 2013 9:00 am
Location: Åland Islands

Re: Newbie's problems understanding how Cron works

Postby Fuddyduddy » Mon Sep 08, 2014 8:50 am

Jocko
Jocko wrote:So with these explanations, please do again what you did and post the cron job line and explain what you want.

With these i will be able to give more details how to set the datetime for a job.
The job line that has appeared in the Jobs List after following your directions is
Code: Select all
* 17 * * 1 /usr/bin/php '/share/1000/cronjobs/Rsync_USB-NAS_backup_1.from.My_Movies_Cn2WQn.php' >>/share/1000/cronjobs/cron.log
To create this, I chose as source folder the smaller of the two I'm trying to back up and tried to schedule it weekly, on Monday of each week, at 1700.

What I was originally intending to do - which I take it was the purpose of your question - was to schedule backups of this plus one other folder. It's probably just me but I found the whole approach counter-intuitive. So your guidance in how to do that - at, say, 3-day intervals - would indeed be welcome. My chief problem now is in trying to understand how to use the five drop-down lists.
Fuddyduddy
Donator VIP
Donator VIP
 
Posts: 162
Joined: Thu Mar 14, 2013 9:00 am
Location: Åland Islands

Re: Newbie's problems understanding how Cron works

Postby Jocko » Mon Sep 08, 2014 12:38 pm

Hi Fuddyduddy

Fuddyduddy wrote:
Code: Select all
* 17 * * 1 /usr/bin/php '/share/1000/cronjobs/Rsync_USB-NAS_backup_1.from.My_Movies_Cn2WQn.php' >>/share/1000/cronjobs/cron.log
To create this, I chose as source folder the smaller of the two I'm trying to back up and tried to schedule it weekly, on Monday of each week, at 1700.
You're almost there...
Be careful, '*' means 'every unit'. With your line, you ask to run the backup every month and every day :thumbup but also every minute :disapprove if the weekday is Monday and Hour 17.
So Cron will run the backup at each Monday at 17h00 but also 17h01; 17h02; ...;17h59
I don't think it is what you want :mrgreen:
Fuddyduddy wrote:What I was originally intending to do - which I take it was the purpose of your question - was to schedule backups of this plus one other folder. It's probably just me but I found the whole approach counter-intuitive. So your guidance in how to do that - at, say, 3-day intervals - would indeed be welcome. My chief problem now is in trying to understand how to use the five drop-down lists.
You can read in the related page
If you select "Every (*)", one optional field 'By step of ' is displayed where you can define a step value (eg. */3 <=> at each three time units)
Now, I assume that you want run the backup every 3 days at 17h30. So the cron job line, will be
Code: Select all
30 17 */3 * * /usr/bin/php '/share/1000/cronjobs/Rsync_USB-NAS_backup_1.from.My_Movies_Cn2WQn.php' >>/share/1000/cronjobs/cron.log
To get this line, you must select 'Every (*)' in the 3th drop-down list and put the value '3' in the related 'By step of ' field.
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Newbie's problems understanding how Cron works

Postby Fuddyduddy » Tue Sep 09, 2014 8:48 am

Hi Jocko

OK, thanks.

This is what I've now done. Hope it's correct.

I emptied the destination folder, so as to start again with a clean sheet (and because I'd anyway messed-up the previous attempt so that all the folders in it had been emptied - yes, I did see the Warning!). I then set up a new Backup (involving the same source and destination folders as last time) and having clicked "Add Scheduled Backup in CRON" scheduled it for 1200 at three-day intervals, following your directions, then clicked on 'Accept'. The job line generated was
Code: Select all
* 12 */3 * * /usr/bin/php '/share/1000/cronjobs/Rsync_USB-NAS_backup_1.from.My_Movies_ZErzJF.php' >>/share/1000/cronjobs/cron.log
On the 'Cron Scheduler' menu I've deleted the previous job from the Jobs List, so now only the new job is listed.

I'm now waiting to observe whether the backed-up folders will duly appear in the destination folder at or shortly after 1200.

One more question, please:- How do I cause the 'Backup' tab (under the 'File Share' menu) to become blank again so that I can set up the other of the two backups I want to schedule? (At present it continues to display the job I've already scheduled).
Fuddyduddy
Donator VIP
Donator VIP
 
Posts: 162
Joined: Thu Mar 14, 2013 9:00 am
Location: Åland Islands

Next

Return to Lacie Network Space vs2 and max version

Who is online

Users browsing this forum: No registered users and 5 guests