rp346
rp346

Reputation: 7028

How to setup cron job for each user

I want to setup crontab to run same jobs for every user on linux, is there any way just to specify the job and it will run for every user ?

Thanks

Upvotes: 0

Views: 2183

Answers (3)

Alex Sánchez
Alex Sánchez

Reputation: 41

Any user can execute "crontab -e" (without sudo) and put your commands, obviously the user must have permissions to execute commands.

Upvotes: 1

Balaji Reddy
Balaji Reddy

Reputation: 475

One option is to add your scripts to root/system crontab like,

either copy your scripts to

/etc/cron.daily/
/etc/cron.hourly/
/etc/cron.monthly/
/etc/cron.weekly/

or

sudo crontab -e

and then add new entry for your script.

And the problem with this option is all commands in script run with administrative privileges (i.e. they are generally run using sudo).

Upvotes: 1

Leon
Leon

Reputation: 12481

I believe /etc/crontab is global, you can add jobs to run for all users to that file.

What I am unsure about is whether you need to restart the cron service for the changes to take affect

Upvotes: 0

Related Questions