Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a root cron task that runs every day. But I want to allow normal users to request that it run immediately, if they so wish. It is a harmless process and it can run as often as needed and these normal users are actually trusted users. But I don't want to give these normal users any special permissions.

Can I allow a normal user to trigger the cron task to run immediately? If so, how? The user will be doing this via a Java app, so I'll probably be using Java's ProcessBuilder.

ProcessBuilder (Java 2 Platform SE 5.0)

I would be great if you can provide a solution with Java ProcessBuilder example code.

share|improve this question
up vote 3 down vote accepted

As variant - create a script (added to crontab) and allow to execute without password http://askubuntu.com/questions/155791/how-do-i-sudo-a-command-in-a-script-without-being-asked-for-a-password

share|improve this answer

You can allow everyone to call this process in addition to (i.e. independently of) the run caused by cron.

Just allow the execution (without password) via sudo, create a wrapper script which does the sudo call and point the users at this script.

share|improve this answer
Can you provide full details and an example, please? Thanks. – MountainX Feb 16 '14 at 23:18
@MountainX The link in the other answer does that. – Hauke Laging Feb 16 '14 at 23:20
it doesn't provide enough detail, so I asked a new question: stackoverflow.com/q/21820343/463994 – MountainX Feb 17 '14 at 3:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.