How to remove line from crontab in shell script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to remove line from crontab in shell script?
# 1  
Old 11-03-2005
How to remove line from crontab in shell script?

Hi folks,

I need to write a rollback script which removes the following line from the crontab:
Code:
0 0 * * * su - orca -c "/home/orca/core-<SCHEMA_NAME>/cleanup/CLI/cleanup_BRMS.ksh -c OC4J_RiGHTv_<SCHEMA_NAME>"

<SCHEMA_NAME> is parameter.

How to do it in ksh?
Maybe it's better to backup the crontab before the inserting and when rolling back ,restoring the backed up crontab.

Thanks in advance,
Nir
# 2  
Old 11-03-2005
crontab

crontab -l >$CRON_TEMP

awk '$0!~/PATTERN/ { print $0 }' $CRON_TEMP >$CRON_NEW

crontab $CRON_NEW

# PATTERN means some words of the line which should not be in new crontab
# 3  
Old 11-03-2005
Thanks!
I'll try it.

Nir
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script working on command line and not on crontab

my problem is this: when I run a script from the command line it works but returns a failure if I run it from crontab. Basically I wanted to send a file to hdfs, I thought it was related to the fact that crontab do not know the path to hdfs so I put the full path but it still does not work: here... (16 Replies)
Discussion started by: beautymind
16 Replies

2. Shell Programming and Scripting

Remove Space and blank line from file in UNIX shell script

I have below file. I want to remove space at begining of every line and then after also remove blank line from file. I use below code for each operation. sed -e 's/^*//' < check.txt > check1.txt sed '/^\s*$/d' < check1.txt > check2.txt above code not remove all the space... (12 Replies)
Discussion started by: Mohin Jain
12 Replies

3. Shell Programming and Scripting

Remove line breaks in csv file using shell script

Hi All, I've a csv file in which the record is getting break into 1 line or more than one line. I want to combine those splits into one line and remove the unwanted character existing in the record i.e. double quote symbol ("). The line gets break only when the record contains double... (4 Replies)
Discussion started by: rajak.net
4 Replies

4. Shell Programming and Scripting

use crontab for a shell script..

hi, i have shell script which checks for service running on platform, if service is receiving calls, then do nothing if service is not receiving calls, then stop the service i want to run this script in 2 timeslots. i.e. in the day from 9 am to 5 pm it should run every 10 minutes and ... (2 Replies)
Discussion started by: gauravah
2 Replies

5. Shell Programming and Scripting

useless line feeds in ldapsearch output. Howto remove with shell script?

Hi $ cat ad.sh ldapsearorg -x -LLL -h sb1131z.testbadbigcorp.org -D "CN=ADMINZZ,OU=AdminRoles,DC=testbadbigcorp,DC=org" -w "UT3w4f57lll--4...4" -b "OU=Test,DC=testbadbigcorp,DC=org" "(&(&(&(&(objectCategory=person)(objectClass=user)(lockoutTime:1.2.840.113556.1.4.804:=4294967295)))))" dn$... (3 Replies)
Discussion started by: slashdotweenie
3 Replies

6. Shell Programming and Scripting

How to remove particular line from file through shell script?

Hi, I am pasring a file line by line. I need to check each field in line and remove particular line. input file lines are, 02;ABC;PQR 03;aaa;rrr 04;ABC;ggg 09;eee;ABC 04;lmn;stu I am looking for line containing "ABC" as field value. Now How can I remove this line from input file... (7 Replies)
Discussion started by: Poonamol
7 Replies

7. Shell Programming and Scripting

how to remove line from /etc/vfstab using shell / perl

Hi, could someone help me on this i want to remove line from /etc/vfstab in the system how to do that it is rite now like this /dev/vx/dsk/appdg1/mytestvol /dev/vx/rdsk/appdg1/mytestvol /mytest vxfs 3 no largefiles /dev/vx/dsk/appdg1/mytestvol1 ... (2 Replies)
Discussion started by: tarunn.dubeyy
2 Replies

8. Shell Programming and Scripting

Can we edit crontab using a shell script

Hi, Can some one tell me if we can configure the jobs in crontab using a shell script. I know it can be done easily by using "crontab -e", but i just want to know whether we can add a job into the crontab using a shell script. If it can be done, plz suggest the procedure to do it. If it... (6 Replies)
Discussion started by: rudrarajumk
6 Replies

9. Shell Programming and Scripting

shell script to remove all lines from a file before a line starting with pattern

hi,, i hav a file with many lines.i need to remove all lines before a line begginning with a specific pattern from the file because these lines are not required. Can u help me out with either a perl script or shell script example:- if file initially contains lines: a b c d .1.2 d e f... (2 Replies)
Discussion started by: raksha.s
2 Replies

10. Shell Programming and Scripting

How do i run a shell script without crontab.

Hi Folks, Could you please suggest me how to run a shell script on a solaris env without using crontab. I am actually trying to write a shell script which will grep "WORD" in the logfile andd sends a email.Thanks in advance. Thanks Sandeep. (3 Replies)
Discussion started by: sandeep anand
3 Replies
Login or Register to Ask a Question