LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 12-03-2009, 03:20 PM   #1
bic
Member
 
Registered: Jan 2005
Distribution: MythDora 3.2, RHEL 6.3
Posts: 101

Rep: Reputation: 16
send email to server to start shell script


I want to be able to send an email to a user on a Redhat 4 box. Depending on the subject of the email, I want to that user to start a specific shell script.

I am thinking I would create a cron to read emails every 5 minutes using mail, if it finds the specific email subject it's looking for it would start the shell script. Is my assumption, using mail, correct? What else might I use?
 
Old 12-03-2009, 03:47 PM   #2
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
It would be fairly easy to parse the mail spool in perl or any variety of programs. I think you should build some verification into your program though if it's possible for the scripts to do anything you would NOT want done by a random stranger. Mail isn't tremendously secure.
 
Old 12-03-2009, 04:30 PM   #3
DrLove73
Senior Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Blog Entries: 1

Rep: Reputation: 129Reputation: 129
Better use "encrypted" text to send a command. Maybe use some password generator, and use several of those to trigger events. You could create a small script on the client end to translate your human readable commands to specific password like trigger.

Also take a look at expect+shh logging and issuing commands, that would be a better way.
 
Old 12-03-2009, 05:43 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,417
Blog Entries: 55

Rep: Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627
The generic idea of a "mail to command" gateway is not new. Searching Freshmeat, Sourceforge, Non-gnu or Berlios for implementable SW should yield result(s).
 
Old 12-03-2009, 07:31 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,441

Rep: Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791
It would be simpler to setup ssh auth_keys and then have src machine login to the target and run the cmd.
 
Old 12-04-2009, 09:06 AM   #6
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
You are correct it would be easier to setup with key'd ssh, however many phones aren't capable of doing that and email can be sent fairly easily from anywhere.
 
  


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
Apache virtual host send email without email server SibLiant Linux - Software 6 06-03-2009 09:46 PM
Having a problem getting my shell script to send an email after each row. mgsmith7475 Linux - Newbie 3 04-27-2009 08:28 PM
write a shell script to send email yenonn Programming 4 02-11-2005 10:06 PM
Qmail: send email from shell mikeshn Linux - General 1 09-30-2004 01:19 AM
send email through shell mikeshn Linux - General 10 01-01-2004 02:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

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