LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-04-2004, 05:26 AM   #1
jon_k
Member
 
Registered: Jul 2003
Location: Fort Worth, Texas
Distribution: Mepis Linux 2004
Posts: 547

Rep: Reputation: 30
Crontab file located in,,, where?


Okay, I got a pretty big problem here, I'm not sure what to do exactly.

I kept trying, trying, restarting from scratch and everything until I was actually yelling and cussing and pulling my hair out. I'm not sure what to do, and hopefully one of you have had a similiar expierience and will be able to share your insight

First off, I don't like crontab -e , actually, not to offend anyone but I hate it. Isn't there a way to edit your own crontab with the editor of your choice?

I am use to editing my crontab file in root on my linux machine at home here using the command nano /etc/crontab

Unfortunately, since I don't have root to this box I'm on... (professionally hosted) I can't do that.

Is there any file where I could edit crontab using the editor of my choice, like... /home/jon/.crontab or something? -- This server is running on Redhat Linux 7.2 by the way, in case the file path may vary from distro to distro.


Now, let me present my problem that made me ask this question to see if you could if anything, help me with this.

You see, I'm not able to get a script to run, I've been adding it to webmin to execute at a certain time... then typeing date like a mad man in SSH waiting for it to go off...... it's time to execute goes by... and nothing ever seems to have happened. Spent 2 hours making the cronjob in webmin trying to get it to work to no avail.

(Actually, I have gotton it to run once or twice... and then when I double-checked to see if it'd work within the next 5 minutes (to make sure I got it working and just not a 1 time thing... it didn't do a darn thing!!!... I'd then create a new cron entry and start over.....)

Thats why I want to add the cron manually, but without crontab -e

Here is a screenshot of the settings for crontab I have... you know.. the settings that don't execute when it's time to execute comes?

http://www.picrack.com/002/avatars/crontab1.JPG



I counted down for it to hit 5:00AM in the ssh console, typing "date" like I was crazy, and 5:00AM went by... 5:01,,, 5:02... 5:03... nothing ever happened, I didn't get "New mail" neither explaining any errors

Any ideas on how I would be able to get this to work... or add the crontab manually WITHOUT using crontab -e?


A tack of the code I'm trying to execute, not that it probably matters though since it runs fine if I ./ it from ssh

Code:
#!/bin/bash

# A script that will back up pserver files by date and time.
# Here's how it works...
#1) Define your variables man!
#
#2) Create a tempdir e.g. July,07-03-2004-09:41:22AM.tempid=1088872882
#   Basically, this creates a temporary dir with all the files in it
#   it is given a temorary ID basted on amount of seconds since jan 1 1970
#
#   I would have used %N which is nano seconds, but the server I coded this
#   for apparently has an older version of date which doesn't support that sequence
#
#3) cp (copy) all the files youw want to back up to the new tempdir, simple enough, heh
#
#4) tarballz the items in the temp directory we made and copied stuff too
#
#5) delete the temp directory and its contents



instance=${1:-palace}
root=${2:-/home/jon/pserver}
temptime=${3:-`date +%B,%m-%d-%Y-%I-%M-%S%p.tempid=%s`}

#script written by Jon Kelley <jonkelley@gmail.com>
#I don't care if you use it or rip it apart or use it in a
#commercial product, just give me credit for it

/home/jon/pserver/bin/stop-palace
# ^^^ Stop server!

mkdir $root/$instance/psdata/backup/$temptime/

cp $root/$instance/psdata/pserver.pat $root/$instance/psdata/backup/$temptime/pserver.pat
cp $root/$instance/psdata/pserver.prp $root/$instance/psdata/backup/$temptime/pserver.prp
cp $root/$instance/psdata/pserver.prefs $root/$instance/psdata/backup/$temptime/pserver.prefs
cp $root/$instance/psdata/pserver.conf $root/$instance/psdata/backup/$temptime/pserver.conf
cp -rf $root/$instance/psdata/plug-conf $root/$instance/psdata/backup/$temptime/plug-conf

tar -cvzf $root/$instance/psdata/backup/`date +%B-%m-%d-%Y--%I-%M-%p`.backup.tgz $root/$instance/psdata/backup/$temptime/

/home/jon/pserver/bin/start-palace
# ^^^ Start the server back up!

rm -rf $root/$instance/psdata/backup/$temptime

Last edited by jon_k; 07-04-2004 at 05:40 AM.
 
Old 07-04-2004, 07:30 AM   #2
JohnLen
LQ Newbie
 
Registered: Jul 2004
Distribution: Slackware 9.1; GNU\Linux Debian 3.1 (stable)
Posts: 17

Rep: Reputation: 0
If you don't like the default editor (probably it's vi on your system), you can set your own editor, by pointing at it's location using VISUAL environment variable.
 
Old 07-04-2004, 10:35 AM   #3
jon_k
Member
 
Registered: Jul 2003
Location: Fort Worth, Texas
Distribution: Mepis Linux 2004
Posts: 547

Original Poster
Rep: Reputation: 30
What would I do for that?

export $visual = /usr/bin/nano ??

Thanks
 
Old 07-04-2004, 01:24 PM   #4
wipe
Member
 
Registered: Jun 2004
Location: High Green
Distribution: Fedora Core 4
Posts: 180

Rep: Reputation: 30
There are many ways to set environment variables, the usual one being:

name=value

When a program executes, it gets its own environment. You can make it inherit variables from the shell the program is executed in. For example:

name=value
export name
program

When you use export name[=value], you don't usually put $ in front of the variable name, otherwise the name is replaced by the variable's content before the command is executed and you end up exporting a different variable.

Put this in your ~/.bash_profile:

export VISUAL=/usr/bin/nano

The "profile" file is executed when the login shell starts, that is to say, when the system boots. The variable VISUAL is then copied to every shell that gets started and is (nearly) always visible.

If you want to know where cron finds its files, I strongly suggest you to read some documentation. "man cron" and "man 1 crontab" give the basics. There also seems to be alternatives to cron. I base this assumption on a quick sf.net search.

Regards
Simon
 
Old 07-04-2004, 01:26 PM   #5
jon_k
Member
 
Registered: Jul 2003
Location: Fort Worth, Texas
Distribution: Mepis Linux 2004
Posts: 547

Original Poster
Rep: Reputation: 30
Wow thanks, was hunting for an answer when I heard the "new mail" notification sound, "Linux Questions Mailer: reply to ccrontab...."

thanks for the answer again!! I'll try it !

[edit]Worked, thank you so much!
 
  


Reply



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
fvwm config file for ALL users, located, where? blacknyx Slackware 3 05-04-2005 12:23 PM
Where is the .config file located? BluePyre Linux - Software 7 08-29-2004 06:13 AM
where is the GNOME config file located? rohan208 Linux - Newbie 1 05-20-2004 04:43 PM
Yum update complains missing file (broken dep), but file can be located. davidas Linux - Software 0 03-27-2004 09:11 PM
where is the wine config file located? osat3ch Fedora 2 02-13-2004 08:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:32 PM.

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