Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 06-30-2014, 08:54 AM   #1
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. ?

Old 06-30-2014, 09:16 AM   #2
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,893

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
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, 09:57 AM   #3
Senior Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 2,810

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


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 02:50 AM
[SOLVED] Bash script: Need some help on how to parse a simple SQL query newbie_0404 Linux - Newbie 10 06-02-2010 12: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 03:43 PM
BASH script alphabetical conditional operator query. lupusarcanus Linux - Newbie 5 03-15-2010 03:14 AM
Bash script problem with ftp session exiting the script early edomingox Programming 5 02-23-2010 05:39 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:55 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration