Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
06-28-2015, 11:27 PM
|
#1
|
Member
Registered: Dec 2014
Posts: 263
Rep:
|
script output different when cron runs it
When I manually run the script below, the output is just the way I want it. When cron runs it, I get like fifty of these ::::::::: in the output of the script.
Is there any chance cron is doing something different when running the script? Any way I can get additional information that will help me troubleshoot the issue?
crontab -e
/root/daily
Code:
#!/bin/bash
#Import Variables
source /root/config/variables
#Random Delay
/bin/sleep $((RANDOM$delayreboot))
#Run Daily
/root/start
|
|
|
06-29-2015, 12:03 AM
|
#2
|
Senior Member
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199
Rep: 
|
Which distro and which version of cron?
|
|
|
06-29-2015, 12:14 AM
|
#3
|
Member
Registered: Dec 2014
Posts: 263
Original Poster
Rep:
|
I'm running raspbian, but I couldn't find a way to get the cron version..
cat /etc/*-release
Code:
PRETTY_NAME="Raspbian GNU/Linux 7 (wheezy)"
NAME="Raspbian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=raspbian
ID_LIKE=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
|
|
|
06-29-2015, 12:18 AM
|
#4
|
Senior Member
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199
Rep: 
|
cron --version?
|
|
|
06-29-2015, 12:20 AM
|
#5
|
Member
Registered: Dec 2014
Posts: 263
Original Poster
Rep:
|
No, not working. I've also googled it and tried to find other ways but nothing works. Cron is running though that's for sure.
cron --version
Code:
cron: invalid option -- '-'
usage: cron
|
|
|
06-29-2015, 01:52 AM
|
#6
|
Senior Member
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199
Rep: 
|
Which image?
|
|
|
06-29-2015, 02:35 AM
|
#7
|
Member
Registered: Dec 2014
Posts: 263
Original Poster
Rep:
|
I am using the image that was released on 2015-02-16
Its the previous one from the current.
|
|
|
06-29-2015, 10:05 AM
|
#8
|
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573
|
It's difficult to say since you haven't showed us what's in /root/config/variables or /root/start.
And what script output are you referring to? You don't have anything going to a log file in what you've shown.
|
|
|
06-29-2015, 07:37 PM
|
#9
|
LQ Veteran
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Rep: 
|
n/m. Sorry.
<vacant_stare>
|
|
|
06-29-2015, 10:29 PM
|
#10
|
Member
Registered: Dec 2014
Posts: 263
Original Poster
Rep:
|
start
Code:
#!/bin/bash
/root/config/commands 2>&1 > /root/log/$HOSTNAME.log
commands
Code:
#!/bin/bash
#Set Variables
source /root/config/variables
#Download Media
/bin/echo "Sync $(/usr/bin/lftp ftp://$ftpuser:$ftppass@$ftphost -e "set ftp:ssl-allow no ; set net:reconnect-interval-base 5 ; set net:max-retries 2 ; mirror -e $remotemedia $localmedia ; quit")"
variables
Code:
#!/bin/bash
#Set Variables
export ftpuser="user_name_here"
export ftphost="ftp_host_here"
export ftppass="pass_here"
export remotemedia="/name/music"
export localmedia="/root/media"
|
|
|
06-29-2015, 10:48 PM
|
#11
|
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573
|
My guess is it has to do with your nested double quotes in commands (not a terrific name for a script BTW). Does anything change if you switch the inside pair to single quotes?
|
|
|
06-30-2015, 12:02 AM
|
#12
|
Member
Registered: Dec 2014
Posts: 263
Original Poster
Rep:
|
this is the result
Code:
::::::::::::::
/root/log/Client38.log
::::::::::::::
Sync
when in fact after the word "Sync" there should be the results of the synchronization process.
|
|
|
06-30-2015, 12:22 PM
|
#13
|
Member
Registered: Dec 2014
Posts: 263
Original Poster
Rep:
|
anyone?
|
|
|
All times are GMT -5. The time now is 06:45 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|