LinuxQuestions.org
Visit Jeremy's Blog.
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 05-29-2015, 10:57 AM   #46
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,260

Rep: Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948

How did you modify the PATH, and in what file?
 
Old 05-29-2015, 03:44 PM   #47
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 306

Rep: Reputation: 121Reputation: 121
Quote:
Originally Posted by tearsforhari View Post
Suicidaleggroll, anyone?

I wrote the above script called "myscript.sh" and put it in a directory with path /home/scripts/myscript.sh. It works just fine. I then set several similar cronjobs, which also work just fine. But I nevertheless get an error mailed as root:
Code:
/home/scripts/myscript1.sh: 13: /home/scripts/myscript1.sh: [[: not found
/home/scripts/myscript2.sh: 23: /home/scripts/myscript2.sh: [[: not found
/home/scripts/myscript3.sh: 33: /home/scripts/myscript3.sh: [[: not found
I am wondering if this has something to do with needing to add /home/scripts to the PATH of the root user. But I don't understand why it is mailing this error when it actually worked?
From the error message, it looks like the shell interpreter does not understand the [[ syntax. When you run a script from cron, it may use another shell instead of bash. Put the following line first in your script, to force it to use bash:
Code:
#!/bin/bash
The if..then..fi blocks are not working as expected (they are doing something, but not what you intended), but the sshfs, rsync, and umount commands appear to be working fine.

Last edited by Beryllos; 05-29-2015 at 03:51 PM. Reason: last paragraph explaining why the backup is working
 
Old 05-30-2015, 01:32 AM   #48
tearsforhari
Member
 
Registered: Mar 2015
Posts: 79

Original Poster
Rep: Reputation: Disabled
I thought I had to add the PATH /home/scripts to some .bashrc file. But I am first trying Beryllos' suggestion, which makes sense.
 
  


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
[SOLVED] rsync between two different servers astalavista2000 Linux - Server 7 12-13-2010 10:10 PM
how to rsync files on two servers that have two different file systems mrotsliah Linux - General 2 08-11-2010 04:29 PM
rsync can not rsync files with include filter... xiutuo Linux - Server 2 07-23-2010 03:10 AM
which is the better way to rsync files between web servers? cooljai Linux - Server 8 05-22-2010 12:32 AM
Could I run rsync to download files from a server without rsync daemon? Richard.Yang Linux - Software 1 09-18-2009 05:08 AM


All times are GMT -5. The time now is 08:47 PM.

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