1

I never use crontab, and while it ask me for root password, I am careful.

So my question is,

I have to run periodically (let's say every 30 min)a simple script for analyze the text file, which is update almost every minute. If the result of the script find exactly what I want, the script kill a proces which update the text file.

So basically I just need some command which runs my analytical script lets say every 30 minute.

I found out that crontab is probably one of the options, but I is it "safe". Why this command require the root password and so on? Or Is there any other options (better, simpler and so on) how to run some script periodically?

Thanks a lot

P.

1
  • If the process you need to kill is your own process, then you can use your own crontab: just set it up using crontab -e instead of sudo crontab -e. That way root is not involved at all. Jan 10, 2015 at 13:23

2 Answers 2

1

I found out that crontab is probably one of the options, but I is it "safe". Why this command require the root password and so on?

Why would requiring a password make something less safe? Using crontab is safe since nobody can change those files unless they know your admin password.

Or Is there any other options (better, simpler and so on) how to run some script periodically?

I myself would use /etc/crontab. It is 1 file for all users (difference with crontab is that you can add a user to a command line) where crontab is 1 file per user. It does not matter if you have 1 user but with 2 or more you would be maintaining more files than needed.

2
  • Thank you for clarify me the safety of using crontab. I ask for crontab safety because many command don't require root password, and I haven't understand why this one has. Jan 10, 2015 at 13:38
  • oh that is simple: any admin task will require it. Consider your account to have 2 purposes: a user and an administrator. The 1st needs no sudo. The 2nd, by default, will require sudo.
    – Rinzwind
    Jan 10, 2015 at 13:53
1

You can set a cronjob for your user only and it will not require your root password.

$ crontab -e

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .