LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-12-2013, 04:52 PM   #1
ikn3
LQ Newbie
 
Registered: Aug 2012
Posts: 7

Rep: Reputation: Disabled
Crontab script


Schedule a script "removelogs" in a CRON job. We have to make this a script and run with the full path

Also please make sure to source the environment before running this.

Not sure what sourcing means and how to achieve it.
TO run the script manually it needs to be run as
". ./removelogs" from its directory.

Adding the ERROR from mailer spool
../pkms.env is missing. Please run cron_removelogs from the scripts dir

Where cron_removelogs = FIle which invokes the script:
cat cron_removelogs
#!/bin/sh

. /home/admin/.bash_profile

# Source the Environment
redit

# Run the removelogscores script
. /<path to actual script>/removelogs


And the path for alias "redit" is mentinoed in /home/admin/.bash_profile

Last edited by ikn3; 03-12-2013 at 05:05 PM.
 
Old 03-12-2013, 07:59 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
1. show us what you've got so far
2. use code tags https://www.linuxquestions.org/quest...do=bbcode#code
3. sourceing means pulling code into the current env either by using
Code:
# this is <dot><space>somefile as per your 
# ". ./removelogs"

. somefile

# or use source cmd
source somefile
You will need to supply a path prefix to somefile so the dot or source cmd can find it.

Useful links you should read
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/
http://www.adminschoice.com/crontab-quick-reference
 
Old 03-12-2013, 10:22 PM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
In simple words, sourcing means to load or set what is mentioned in specified file line-by-line. So,
Code:
. /<path to actual script>/removelogs
... means that read the file removelogs line-by-line and load or set everything mentioned in it, in your working shell environment.

Similarly,
Code:
. /home/admin/.bash_profile
... means that read the file .bash_profile line-by-line and load or set everything mentioned in it, in your working shell environment.

I suppose, your script (which has to be scheduled in cron) is cron_removelogs, not removelogs file.

Anyway, let's know what problem you're facing?

Last edited by shivaa; 03-12-2013 at 10:23 PM.
 
  


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
Script is not running in Crontab Deepesh_tr Linux - Newbie 8 09-02-2012 07:43 PM
Script crontab jedi777 Linux - Newbie 2 01-27-2011 12:52 AM
[SOLVED] Crontab Script Not Running th1bill Ubuntu 4 12-10-2010 03:49 PM
[SOLVED] one script does not work at crontab windstory Linux - Newbie 7 08-13-2010 02:56 AM
Runs Multiple shell script inside a main script using crontab srimal Linux - Newbie 4 10-22-2009 06:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:10 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