LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-08-2009, 03:34 AM   #16
WhisperiN
Member
 
Registered: Jun 2009
Location: Middle East
Distribution: Slackware 13.1, CentOS 5.5
Posts: 137

Original Poster
Rep: Reputation: 17

Great to find the topic taking deep discussion where the information grow more and more..


Alright, here we come to something else..
  • I did really create my own designated directory, called it:
    /mybin
  • I moved my own-made-scripts into it, from the previous directory /bin
  • I updated my $PATH to include the new directory (I prefer to call the script by its name only rather than the full bath.. time saving..!!)
  • It worked, and I was able to call it by the name.. so I thought it worked.

Well, I found a problem..
I have into my cron jobs this for example:

Code:
30 * * * * some-script
That some-script was in /bin and the cron job was succeeding to find it.
Now, after I put it into the new directory.. I get this error:
Code:
/bin/sh: some-script: command not found
Even-though, I can call it directly from the command line like:
Code:
~# some-script
Is there something more that I'll have to do to have the Crond able to find it?


Regards..
 
Old 11-08-2009, 03:52 AM   #17
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198
Quote:
Originally Posted by WhisperiN View Post
Is there something more that I'll have to do to have the Crond able to find it?
cron does not have the usual path. If you change the crontab entry to use the full path it will run. If you want to see what $PATH crontab uses add echo $PATH > some_file at the beginning of the script. If your script relies on $PATH then you may want to set $PATH in the script itself.
 
Old 11-08-2009, 04:50 AM   #18
pcunix
Member
 
Registered: Dec 2004
Location: MA
Distribution: Various
Posts: 149

Rep: Reputation: 23
And (as I said before) you SHOULD use the full path in cron or anything else that calls it.

It's fine to have this in your PATH for your convenience at the command line. In cron and scripts, it's smarter to call it explicitly so that when you or someone else looks at this five years from now, there's no struggle to find out what your command actually does.
 
Old 11-08-2009, 05:35 AM   #19
WhisperiN
Member
 
Registered: Jun 2009
Location: Middle East
Distribution: Slackware 13.1, CentOS 5.5
Posts: 137

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by catkin View Post
cron does not have the usual path. If you change the crontab entry to use the full path it will run. If you want to see what $PATH crontab uses add echo $PATH > some_file at the beginning of the script. If your script relies on $PATH then you may want to set $PATH in the script itself.
Thank buddy for the addition..

Now I see ;-)



Quote:
Originally Posted by pcunix View Post
And (as I said before) you SHOULD use the full path in cron or anything else that calls it.

It's fine to have this in your PATH for your convenience at the command line. In cron and scripts, it's smarter to call it explicitly so that when you or someone else looks at this five years from now, there's no struggle to find out what your command actually does.

I believe your are totally right..
There is no big deal in adding the full path to the cronjob line since it's a one-time entry..

Thanks for you all who shared the giving..

Much Regards, and see you into another discussion..

(Here if you have a clue..
Very Secure FTP (vsftpd) refuse to start on Slackware Current)
 
Old 11-08-2009, 07:50 AM   #20
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Rep: Reputation: 57
Quote:
Originally Posted by tredegar View Post
sbin is usually for commands that must be run as root, the superuser
/usr/local/bin is a good place for your personal commands / scripts
what about placing them under debian under
/usr/bin
then chmod +x them

or why not to leave them into /usr/share... ?

or eventually under

$HOME/scripts ?
 
  


Reply


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
where do i put my written scripts mahmoud Linux - Newbie 2 11-27-2007 05:42 PM
How to put scripts in the startup..? balavignesh Linux - Software 1 08-28-2006 10:43 AM
Where to put mldonkey scripts? Aioth Slackware 2 06-19-2004 08:29 AM
put my scripts to PATH Boby Linux - Newbie 1 06-14-2004 12:01 PM
Where to put protected scripts in Apache GoTrolling Linux - Software 4 01-16-2004 01:04 PM

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

All times are GMT -5. The time now is 01:43 AM.

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