Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 03-12-2013, 04:52 PM   #1
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

. /home/admin/.bash_profile

# Source the Environment

# 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
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,848

Rep: Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584
1. show us what you've got so far
2. use code tags
3. sourceing means pulling code into the current env either by using
# 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
Old 03-12-2013, 10:22 PM   #3
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,
. /<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.

. /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.


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
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 > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:32 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
Open Source Consulting | Domain Registration