Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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)
http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/ProcessBuilder.html

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

share|improve this question

2 Answers 2

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 at 23:18
    
@MountainX The link in the other answer does that. –  Hauke Laging Feb 16 at 23:20
    
it doesn't provide enough detail, so I asked a new question: stackoverflow.com/q/21820343/463994 –  MountainX Feb 17 at 3:46

Your Answer

 
discard

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.