Cron Job

slopeofhope

Master Member
Joined
Jan 2, 2009
Messages
3,784
Reaction score
0
Hi,

Does any one know how to setup a cron job?

I have folder A and folder B.

I am thinking of setting up a cron job to help me rename folder A to folder C and folder B to folder A every day at a specific time.

Anyone knows how to do it?
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,547
Reaction score
1,300
Hi,

Does any one know how to setup a cron job?

I have folder A and folder B.

I am thinking of setting up a cron job to help me rename folder A to folder C and folder B to folder A every day at a specific time.

Anyone knows how to do it?

Unix I assume ?

Type "crontab -e"

Read the manual "man cron"

The command to move folders as you have described is

mv a c && mv b a

or

mv a c; mv b a
 

stougard

Junior Member
Joined
Jun 13, 2005
Messages
48
Reaction score
0
crontab -e

That opens an editor, usually vi (you should know how to use it anyway).

0 0 * * * mv full_path/a full_path/c && mv full_path/b full_path/a

The cron is launched from the home of the user, good practice is to indicate full path when your cron entry try to reach a specific folder.

Note as well that "b" folder will cease to exist at midnight and that "a" will be placed inside "c" if "c" already exists.
 
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ Forums. Forum members and moderators are responsible for their own posts. Please refer to our Community Guidelines and Standards and Terms and Conditions for more information.
Top