View the Most Wanted LQ Wiki articles.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-04-2006, 03:42 AM   #1
LQ Newbie
Registered: Jan 2006
Posts: 14

Rep: Reputation: 0
BASH :Reading the crontab, and editing it

Hey, i was wondering how would i make a BASH script view the crontab file, read the times for each line and only select the lines that are idetified some how

The main idea for it is, i want this bash script to be able to control certain part of the crontab so it can be a manager for a bunch of backupscripts i have coded
Old 02-04-2006, 05:05 AM   #2
Senior Member
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
Post what you have and we'll help you out from there.

Old 02-04-2006, 08:25 AM   #3
LQ Newbie
Registered: Jan 2006
Posts: 14

Original Poster
Rep: Reputation: 0
well i dont exactly have anything yet, and im only new to bash but i thought it would nice to be able to make something that is useful, i have some ideas for it but if anyone can point me to some cmds or guides that would be helpful

PS someone writing it is also good since i can read through it and find how it was made
Old 02-04-2006, 05:28 PM   #4
Senior Member
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Try looking at sed. If you use the -i option you can modify the files in place. Are you familiar with regular expressions? That will be of GREAT help regardless of how you go about this or what you need to get done. Are you trying to add/remove lines, or just edit what each line says? Adding and removing lines can be done with cat, head, tail, grep, and >> using temporary files.
Old 02-05-2006, 07:43 AM   #5
Senior Member
Registered: Mar 2004
Location: england
Distribution: Debian, Mint, Puppy, Raspbian
Posts: 3,371

Rep: Reputation: 192Reputation: 192
I would say,
don't mess around with your crontab file directly.
it's not a good idea.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using crontab in a bash script nro Linux - Newbie 3 08-26-2005 09:04 PM
editing crontab djgerbavore Slackware 12 05-30-2005 10:24 PM
editing /etc/shells to only allow bash omg-ffs Linux - Newbie 3 12-05-2004 04:20 PM
bash: reading a particular line seb3579 Linux - Newbie 2 09-14-2004 04:01 AM
bash script for database searching using crontab saurya_s Linux - Software 5 01-22-2004 09:53 AM

All times are GMT -5. The time now is 04:28 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration