LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 06-30-2014, 09:54 AM   #1
robinaspey
LQ Newbie
 
Registered: Jun 2014
Posts: 3

Rep: Reputation: Disabled
Bash script problem / query.


I am running scripts on a DD-WRT router. The first bash script mounts the USB partitions with other scripts, one of which is called to send an email using MSMTP to my gmail account. This works fine when I login after a reboot.

MSMTP requires .msmtprc to have its ownership set to current
user, e.g. chmod 600 .msmtprc. and it needs to be in the
current home directory.

When running the script to send an email my script copies
.msmtprc to ~/ (e.g. home) which appears to be '/' on bootup
but when I login it sets home to '/tmp/root'

I am unable to get the script to run automatically at startup
due to this issue I believe although it may be something else.
As I mentioned if I run from /tmp/root via normal login it works but using the script method on bootup it doesnt.

Anyone know how to resolve this. ?

Rob
 
Old 06-30-2014, 10:16 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Jessie 8.4
Posts: 5,873

Rep: Reputation: 348Reputation: 348Reputation: 348Reputation: 348
Quote:
When running the script to send an email my script copies
.msmtprc to ~/ (e.g. home) which appears to be '/' on bootup
It may be that, for some reason, the ~ in front of / is being ignored. Try editing the script to read ~/$USER.
 
Old 06-30-2014, 10:57 AM   #3
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 2,614

Rep: Reputation: 703Reputation: 703Reputation: 703Reputation: 703Reputation: 703Reputation: 703Reputation: 703
HOME may not be set when this runs at startup. You could add a symbolic link in / to /tmp/root/.msmtprc
 
  


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
[HELP] Query PHP script using Bash reneg4d3 Red Hat 5 02-21-2014 03:50 AM
[SOLVED] Bash script: Need some help on how to parse a simple SQL query newbie_0404 Linux - Newbie 10 06-02-2010 01:31 AM
How do I make my BASH script yes/no user input query terminate with 3 invalid inputs? lupusarcanus Linux - Newbie 9 03-16-2010 04:43 PM
BASH script alphabetical conditional operator query. lupusarcanus Linux - Newbie 5 03-15-2010 04:14 AM
Bash script problem with ftp session exiting the script early edomingox Programming 5 02-23-2010 06:39 AM


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