07-15-2009
scripting Bash to access ISP mail
I'm trying to create a small program to look at my isp and pull down the messages into individual text files. This is just a read only setup. I need to pull down the message and kill it on the server.
I'm stuck here. I have experimented with a for string but it always fails. I was trying to use date-time and the text file name and end with a .txt. I could read and delete them.
Any suggestions
#!/bin/bash
#
username="mlxxx@vabb.upn";
password="xyzpdq";
sleep 2
echo USER $username
sleep 1
echo PASS $password
sleep 2
echo STAT
sleep 1
echo QUIT
#
# cmdline string to count messages
#./getmail.sh | telnet mail.vabb.upn 110 | tail -n1 | cut -c5
---------- Post updated at 05:25 PM ---------- Previous update was at 03:49 PM ----------
here is the older version of the same code. This has the for statement that doesn't work
sleep 2
echo USER $username
sleep 1
echo PASS $password
sleep 2
echo STAT
sleep 1
#echo RETR 1
#
for i in $(seq 1 10); do echo "RETR $i">mail.txt | sleep 2 | mv mail.txt /home/otg1017/Mail/`date '+%Y%m%d-%T'`.txt ; done
sleep 2
echo QUIT
This is the command line used
# $ ./getmail.sh | telnet mail.vabb.com 110
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
see the thread
Edit the line with the ###EDIT on it to begin:
print -p d
rather then print -p p (0 Replies)
Discussion started by: serm
0 Replies
2. UNIX for Advanced & Expert Users
Hi all,
Is it possible that I can access a webmail inbox using unix shell scripting? If that is possible, can you please give me some tips so that i can proceed further?
Thanks,
Geetha (6 Replies)
Discussion started by: iamgeethuj
6 Replies
3. Shell Programming and Scripting
I have shell script which will try to login to SQL Plus and retrieve some data, based on the outcome i will proceed further
Below is the content of the file
pebblz02% cat test1.ksh
#! /bin/ksh
dummyvar=`sqlplus -S csm_admin/csm_admin@SIDNAME <<EOF echo hi; exit; EOF`
Error message on... (0 Replies)
Discussion started by: kiranlalka
0 Replies
4. Emergency UNIX and Linux Support
i have configured mail server with postfix with dovecot with no encryption:
When connecting with Thunderbird imap is working fine. when sending email from another domain to this domain again it is fine. but when i want to send mail frommy domain to another it gives me error and this is... (3 Replies)
Discussion started by: majid.merkava
3 Replies
5. Solaris
We want to get a notification for all unauthorized sudo access via e-mail to our team DL .. whats the way to do it ? (1 Reply)
Discussion started by: fugitive
1 Replies
6. Programming
Hi
Can anyone please help me out in the below requirement,
Need to access the mailbox of any Email server like gmail, yahoo etc.. and access the Inbox and check Emails.
If i have to access gmail Inbox of any user, My Input parameter will be the domain name, Email ID and Password. example... (3 Replies)
Discussion started by: vidhyaS
3 Replies
7. Shell Programming and Scripting
Hi,
Background: There are 2 servers server1 and server2
In server1 i have my script to perform a functionality from the script in server1 i m calling a script named action in server2. The script action has to check the size of a file in a particular location in server1, if the size of the file... (1 Reply)
Discussion started by: jayii
1 Replies
8. UNIX for Dummies Questions & Answers
I'm not a Linux newbie but this seemed like a pretty n00b question. I am familiar with Postfix/Dovecot setups but now I am looking for the simplest way to access mail on a Linux system, such as the mail that goes to /var/mail/root. I know I can edit /etc/aliases and have the system mail go straight... (6 Replies)
Discussion started by: TayKimchi
6 Replies
9. Shell Programming and Scripting
How do I go about programming my system? I have access to multiple data bases but no way to operate them (1 Reply)
Discussion started by: C-lo
1 Replies
LEARN ABOUT CENTOS
systemd-suspend.service
SYSTEMD-SUSPEND.SERVICE(8) systemd-suspend.service SYSTEMD-SUSPEND.SERVICE(8)
NAME
systemd-suspend.service, systemd-hibernate.service, systemd-hybrid-sleep.service, systemd-sleep - System sleep state logic
SYNOPSIS
systemd-suspend.service
systemd-hibernate.service
systemd-hybrid-sleep.service
/usr/lib/systemd/systemd-sleep
DESCRIPTION
systemd-suspend.service is a system service that is pulled in by suspend.target and is responsible for the actual system suspend.
Similarly, systemd-hibernate.service is pulled in by hibernate.target to execute the actual hibernation. Finally,
systemd-hybrid-sleep.service is pulled in by hybrid-sleep.target to execute hybrid hibernation with system suspend.
Immediately before entering system suspend and/or hibernation systemd-suspend.service (and the other mentioned units, respectively) will
run all executables in /usr/lib/systemd/system-sleep/ and pass two arguments to them. The first argument will be "pre", the second either
"suspend", "hibernate", or "hybrid-sleep" depending on the chosen action. Immediately after leaving system suspend and/or hibernation the
same executables are run, but the first argument is now "post". All executables in this directory are executed in parallel, and execution
of the action is not continued until all executables have finished.
Note that scripts or binaries dropped in /usr/lib/systemd/system-sleep/ are intended for local use only and should be considered hacks. If
applications want to be notified of system suspend/hibernation and resume, there are much nicer interfaces available.
Note that systemd-suspend.service, systemd-hibernate.service, and systemd-hybrid-sleep.service should never be executed directly. Instead,
trigger system sleep states with a command such as "systemctl suspend" or similar.
Internally, this service will echo a string like "mem" into /sys/power/state, to trigger the actual system suspend. What exactly is written
where can be configured in the "[Sleep]" section of /etc/systemd/sleep.conf. See systemd-sleep.conf(5).
OPTIONS
systemd-sleep understands the following commands:
-h, --help
Print a short help text and exit.
--version
Print the systemd version identifier and exit.
suspend, hibernate, hybrid-sleep
Suspend, hibernate, or put the system to hybrid sleep.
SEE ALSO
systemd-sleep.conf(5), systemd(1), systemctl(1), systemd.special(7), systemd-halt.service(8)
systemd 208 SYSTEMD-SUSPEND.SERVICE(8)