Share your knowledge at the LQ Wiki.
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, 02: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, 04: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, 07: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, 04: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, 06:43 AM   #5
Senior Member
Registered: Mar 2004
Location: england
Distribution: Debian, Mint, Puppy, Raspbian
Posts: 3,421

Rep: Reputation: 200Reputation: 200Reputation: 200
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 08:04 PM
editing crontab djgerbavore Slackware 12 05-30-2005 09:24 PM
editing /etc/shells to only allow bash omg-ffs Linux - Newbie 3 12-05-2004 03:20 PM
bash: reading a particular line seb3579 Linux - Newbie 2 09-14-2004 03:01 AM
bash script for database searching using crontab saurya_s Linux - Software 5 01-22-2004 08:53 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:48 PM.

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