LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 12-14-2012, 01:10 PM   #16
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

User continued thread from: http://www.linuxquestions.org/questi...20#post4849420
 
Old 12-14-2012, 02:57 PM   #17
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,706

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
Since you are using ssh (good), you should also use RSA authentication... And if you wanted to avoid allowing public/general access to the possibility of logging in as root, you can also run sshd on a non-standard port (blocked from all access except a trusted list).

No password required.

That would simplify your script considerably by eliminating the expect script.

As for the reason for no mail, cron only sends mail if it has output to send. Since you redirected all output to a file, there is no output to be mailed.
 
Old 12-16-2012, 06:28 PM   #18
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,396

Rep: Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395
You should be able to get the uptime with a non-root user.
 
Old 04-25-2016, 08:08 AM   #19
iamre00t00
LQ Newbie
 
Registered: Apr 2016
Posts: 1

Rep: Reputation: Disabled
Lightbulb Expect has the path hardcoded in the binary

I would do a simlink of expect in /usr/bin and see if it solves your problem...
The result of an ls -l would be /usr/bin/expect -> /usr/local/bin/expect
The idea is using a symbolic link, stty would have been seen "as" in /usr/local/bin also... but saves you the copy and maintnance of 2 binaries...
I would also try loading into your script the .profile of the user that is launching the script even if it's the same user that is launching the crontab,
as crontab does not load any profile or environment.
This should get it fixed

Last edited by iamre00t00; 04-25-2016 at 08:10 AM. Reason: Better communication
 
Old 04-25-2016, 09:22 AM   #20
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,706

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
Quote:
Originally Posted by iamre00t00 View Post
I would do a simlink of expect in /usr/bin and see if it solves your problem...
The result of an ls -l would be /usr/bin/expect -> /usr/local/bin/expect
The idea is using a symbolic link, stty would have been seen "as" in /usr/local/bin also... but saves you the copy and maintnance of 2 binaries...
I would also try loading into your script the .profile of the user that is launching the script even if it's the same user that is launching the crontab,
as crontab does not load any profile or environment.
This should get it fixed
A better solution is just to add /usr/local/bin to the PATH environment variable.

BTW, I don't believe the .profile is used for cron jobs UNLESS the environment specification in the crontab includes it.
 
  


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
Crontab doesn't give the output of the file it runs in terminal pranavojha Linux - Software 3 08-24-2013 04:19 PM
send all output to file, gzip in crontab figure20012 Linux - Newbie 5 08-27-2012 04:26 AM
E-Mailing whole output of a file with crontab amario26 Linux - Newbie 1 05-03-2011 11:44 AM
Crond not reading/running /etc/crontab file [CentOS5] neocookie Linux - Software 6 09-24-2008 11:59 AM
running gpg to encrypt file from crontab aeby Linux - Security 8 05-28-2007 09:49 AM

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

All times are GMT -5. The time now is 07:38 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration