By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,737 Members | 1,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,737 IT Pros & Developers. It's quick & easy.

How to kill a process automatically?

P: 79
Hi,

I want to kill a process at 5.00 p.m .

I tried using crontab.

In crontab i gave like this:-

17 00 * * * kill processid.(say 1234)

but it is not killing the process at that time?

how should i give in crontab?

I don't have root permission.

only sudoers permission i have.

How sholud i do this?

with regards

Archana
Dec 19 '07 #1
Share this Question
Share on Google+
6 Replies

P: 69
First of all you must be sure you have rights to kill pid you want, i.e.: you can only kill pid you launched unless you are root.

Hi,

I want to kill a process at 5.00 p.m .

I tried using crontab.

In crontab i gave like this:-

17 00 * * * kill processid.(say 1234)

but it is not killing the process at that time?

how should i give in crontab?

I don't have root permission.

only sudoers permission i have.

How sholud i do this?

with regards

Archana
Dec 19 '07 #2

Motoma
Expert 2.5K+
P: 3,237
You should probably put some sort of error logging on the cron line, perhaps redirecting both stderr and stdout to a file.

My initial thought is that the user cron is being run as doesn't have the kill program in its $PATH.

Hi,

I want to kill a process at 5.00 p.m .

I tried using crontab.

In crontab i gave like this:-

17 00 * * * kill processid.(say 1234)

but it is not killing the process at that time?

how should i give in crontab?

I don't have root permission.

only sudoers permission i have.

How sholud i do this?

with regards

Archana
Dec 19 '07 #3

P: 79
You should probably put some sort of error logging on the cron line, perhaps redirecting both stderr and stdout to a file.

My initial thought is that the user cron is being run as doesn't have the kill program in its $PATH.
Hi,

can u explain a bit more about this ?



with regards
Archana
Dec 20 '07 #4

Motoma
Expert 2.5K+
P: 3,237
Hi,

can u explain a bit more about this ?



with regards
Archana
The first part: tack on "> /var/log/cron.kill.log 2>>&1" (sans quotes) to the end of your cron script. This will redirect any errors to the file /var/log/cron.kill.log for you to analyze.

What I think is happening is that the cron script A) unable to find the "kill" program, B) the cron script does not have permissions to kill the job, or C) the cron job isn't getting the right PID.
Dec 20 '07 #5

P: 79
The first part: tack on "> /var/log/cron.kill.log 2>>&1" (sans quotes) to the end of your cron script. This will redirect any errors to the file /var/log/cron.kill.log for you to analyze.

What I think is happening is that the cron script A) unable to find the "kill" program, B) the cron script does not have permissions to kill the job, or C) the cron job isn't getting the right PID.

Hi,

Do i have to include "> /var/log/cron.kill.log 2>>&1" in crontab file?
I tried doing that but it didn't kill the script?

i gave like this:-crontab -e

18 22 * * * kill processid.

I can't give sudo kill in crontab and i can't give password also.(I tried giving but didn't work)

process id is taken correctly.

I checked crin file in that it was given like ORPHAN (no passwd entry)

I don't have root permission.

what are the otherways so that i can stop process without root permissions?

with regards

Archana
Dec 21 '07 #6

Motoma
Expert 2.5K+
P: 3,237
Do i have to include "> /var/log/cron.kill.log 2>>&1" in crontab file?
I tried doing that but it didn't kill the script?
Right, but what it will do is create a file in /var/log called cron.kill.log which will have your errors listed.

If that file does not exists, change it to your home directory.
Dec 21 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.