LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 06-28-2015, 11:27 PM   #1
aristosv
Member
 
Registered: Dec 2014
Posts: 261

Rep: Reputation: 3
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
Code:
@daily /root/daily
/root/daily
Code:
#!/bin/bash
#Import Variables
source /root/config/variables
#Random Delay
/bin/sleep $((RANDOM$delayreboot))
#Run Daily
/root/start
 
Old 06-29-2015, 12:03 AM   #2
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199

Rep: Reputation: 164Reputation: 164
Which distro and which version of cron?
 
Old 06-29-2015, 12:14 AM   #3
aristosv
Member
 
Registered: Dec 2014
Posts: 261

Original Poster
Rep: Reputation: 3
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"
 
Old 06-29-2015, 12:18 AM   #4
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199

Rep: Reputation: 164Reputation: 164
cron --version?
 
Old 06-29-2015, 12:20 AM   #5
aristosv
Member
 
Registered: Dec 2014
Posts: 261

Original Poster
Rep: Reputation: 3
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
 
Old 06-29-2015, 01:52 AM   #6
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199

Rep: Reputation: 164Reputation: 164
Which image?
 
Old 06-29-2015, 02:35 AM   #7
aristosv
Member
 
Registered: Dec 2014
Posts: 261

Original Poster
Rep: Reputation: 3
I am using the image that was released on 2015-02-16
Its the previous one from the current.
 
Old 06-29-2015, 10:05 AM   #8
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141
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.
 
Old 06-29-2015, 07:37 PM   #9
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
n/m. Sorry.
<vacant_stare>
 
Old 06-29-2015, 10:29 PM   #10
aristosv
Member
 
Registered: Dec 2014
Posts: 261

Original Poster
Rep: Reputation: 3
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"
 
Old 06-29-2015, 10:48 PM   #11
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141
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?
 
Old 06-30-2015, 12:02 AM   #12
aristosv
Member
 
Registered: Dec 2014
Posts: 261

Original Poster
Rep: Reputation: 3
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.
 
Old 06-30-2015, 12:22 PM   #13
aristosv
Member
 
Registered: Dec 2014
Posts: 261

Original Poster
Rep: Reputation: 3
anyone?
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script runs Manually but not in Cron, yet other parts of the script run mccartjd Linux - Newbie 5 01-08-2012 06:54 PM
Script runs if executed from CL, not from Cron Ravendark Programming 6 10-13-2010 06:07 AM
Script runs manually but not from cron redvelo Linux - Newbie 6 09-29-2010 01:37 PM
python rsync script runs from shell not from cron beanbox Programming 3 11-18-2009 06:23 PM
bash script runs different when cron executed jalder85 Linux - Server 4 02-20-2009 11:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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