Quote:
Another thought. Perhaps you are "re-inventing the wheel"
There are existing command-line utilities for retrieving email. fetchmail is one. This search pulled up more information.
Just a thought.
|
This is not just to grab the email , if it was just to watch my email then i would use roundcube , this script will be used to execute commands that i will send to a specific email address .
So , the script will see every x time if any email exists in some account , case exists then retrieve the email by email to local folder , then delete those emails from the account , and then after parsing the emails on local folder for who sent and witch commands were requested it will execute them on server .
Look , i need to write this script because there is nothing ever done like this , usually by default a sys admin connect to a server using a ssh and execute what he needs , i can also do that , and i do it , but when you are on an android phone somewhere with a small display and with a complex ssh login connection as i have in my server it is impossible , not even mention if your phone is not rooted and you dont have most of the tools to do this job .
so if i send "video add 1.1.1.1" as a subject , then my script will interpret that i want to add the ip 1.1.1.1 to the video streaming location in firewall , but if i write "video rem 1.1.1.1" then it will remove that ip from firewall , and this is just a sample of what will do .
I will always find a way to make it work , maybe i will use expect or tty echo , but only if no solution appear here witch i have some doubts because there is always someone here that knows how to do it , i never saw here anything that did not had a solution .
Anyway , i was looking in this code :
https://www.cyberciti.biz/tips/remov...p3-server.html
This code executes 2 scripts at same time to do the job , 1 is the telnet connection to server and the other are the commands .
UPDATE
Well , expect is out of question , it looks it needs its own interpreter to run , witch means i have to create a new script with the commands to be able to run in expect .
ttyecho won the prize .
http://www.humbug.in/2010/utility-to...minals-ttypts/
After compilation i only need to launch telnet on another tty , like
Quote:
setsid sh -c 'exec telnet $server $port > connect <> /dev/tty9 >&0 2>&1' &
|
and then from this script everything can be done with these commands :
Quote:
ttyecho -n tty? USER someusername
|
and etc ....