LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 02-01-2013, 07:22 AM   #1
pommeldier
LQ Newbie
 
Registered: Feb 2013
Posts: 7

Rep: Reputation: Disabled
Question Shell script for closing and starting Evolution Mail?


Hello,

I've been looking for shell script that closes Evolution and eventually starts it again so I can clear the e-mails in custom made folder with a crontab command. But i can't quite find one, neither that i have an idea how to make one. I'm new to Ubuntu.

Or if they're is a better way to do this then i'm pleased to hear it.

Thanks,

Pommeldier.
 
Old 02-01-2013, 09:00 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 5,712
Blog Entries: 12

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
Try using pkill(1).

One of the most common script types to use is bash. Here are some references to get you going:
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
http://tldp.org/LDP/abs/html/
http://floppix.ccai.com/scripts1.html

The simplest script here would be:

Code:
#!/bin/bash
# script to kill evolution, run my cron, and then re-run evolution

pkill -signal 9 evolution
(run your cron command here)
evolution &;
 
1 members found this post helpful.
Old 02-01-2013, 09:48 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,359
Blog Entries: 55

Rep: Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546
Quote:
Originally Posted by rtmistler View Post
Try using pkill(1).
Its manual or info pages or documentation should confirm that but IIGC Evolution has a switch to force closing it down. Since it has one it's probably more graceful. If you need to use 'pkill' then the suggested way is to use a -15 first, (u)sleep a bit and then -9.


Quote:
Originally Posted by pommeldier View Post
clear the e-mails in custom made folder
How or what with does Evolution populate this "custom made folder"? Is its source a remote IMAP or POP3 account? Or a local filter or search result? I'm not saying it has (I don't use it), but Evolution is a matured product so it may have scripts or plug-ins, or maybe expose its API in other ways, to accomplish what you want. And even if it doesn't have anything useful it may be an interesting suggestion for developers to look into...
 
Old 02-04-2013, 05:47 AM   #4
pommeldier
LQ Newbie
 
Registered: Feb 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by unSpawn View Post
Its manual or info pages or documentation should confirm that but IIGC Evolution has a switch to force closing it down. Since it has one it's probably more graceful. If you need to use 'pkill' then the suggested way is to use a -15 first, (u)sleep a bit and then -9.
Do i just put the -15 infront of the -signal 9?



Quote:
Originally Posted by unSpawn View Post
How or what with does Evolution populate this "custom made folder"? Is its source a remote IMAP or POP3 account? Or a local filter or search result? I'm not saying it has (I don't use it), but Evolution is a matured product so it may have scripts or plug-ins, or maybe expose its API in other ways, to accomplish what you want. And even if it doesn't have anything useful it may be an interesting suggestion for developers to look into...
Im using a POP3 account.
 
Old 02-04-2013, 06:45 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,359
Blog Entries: 55

Rep: Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546
Quote:
Originally Posted by pommeldier View Post
Do i just put the -15 infront of the -signal 9?
Try something like 'pkill -TERM [something]; sleep 3s; pkill -KILL [something];'.


Quote:
Originally Posted by pommeldier View Post
Im using a POP3 account.
OK, but how or what with does Evolution populate this "custom made folder"? It's not a "plain" view of a POP3 mail box isn't it? Is it a local message filter or search result or something?
 
Old 02-04-2013, 07:50 AM   #6
pommeldier
LQ Newbie
 
Registered: Feb 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by unSpawn View Post
OK, but how or what with does Evolution populate this "custom made folder"? It's not a "plain" view of a POP3 mail box isn't it? Is it a local message filter or search result or something?
Ill explain the use of this folder. It's just a folder that filters e-mails with certain e-mail adresses and puts them in this folder. Does this answer your question?
 
Old 02-04-2013, 08:46 AM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,359
Blog Entries: 55

Rep: Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546
I don't like guessing but I'd say it's like a "virtual folder" (as in http://library.gnome.org/users/evolu...olders.html.en), and editing the search conditions should update its contents (or see if Ctrl+E works). Else, like I said before, it may be something for the developers to look into. Check http://bugzilla.gnome.org/ for related open tickets and workarounds and else create your own suggestion or bug report?
 
Old 02-04-2013, 09:19 AM   #8
pommeldier
LQ Newbie
 
Registered: Feb 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
I guess it is a virtual folder. But anyway. I solved the half of my problem. I made 3 different bash scripts with one that kills, clears and starts.
But now i clear the mbox file of the subfolder and it shows 0 bytes. But in the folder when i start evolution. The mails are not gone.

Any idea how i could delete them?
 
Old 02-04-2013, 10:11 AM   #9
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,707

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
You risk serious mail corruption by aborting evolution with a -9. It could be in the middle of updating an index and killing that could leave the index in an unknown state.
 
Old 02-04-2013, 11:17 AM   #10
Rupadhya
Member
 
Registered: Sep 2012
Location: Hoffman Estates, IL
Distribution: Fedora 20
Posts: 167

Rep: Reputation: Disabled
I have been doing the following in my backup script.
Code:
echo Evolution Backup Started `date` >> $RajHome/backup.log
# shutdown evolution, so we get a good backup
/usr/bin/gconftool-2 --shutdown >/dev/null
/usr/bin/evolution --force-shutdown >/dev/null
This seems to shutdown Evolution nicely..

- Raj
 
1 members found this post helpful.
Old 02-07-2013, 06:37 AM   #11
pommeldier
LQ Newbie
 
Registered: Feb 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
I solved it my problem with this:

pkill Evolution
03 * * * * > /blablabla/thefile
evolution &

I used a different Bash script for every single line. Because for some reason it doesn't work if i put it in a single script.
And i added the 3 scripts to crontab.

Last edited by pommeldier; 02-07-2013 at 06:38 AM.
 
Old 02-07-2013, 06:57 AM   #12
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,707

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
pkill is not necessarily a graceful shutdown. could be, if it is caught and appropriately handled.
 
Old 02-07-2013, 08:02 AM   #13
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,359
Blog Entries: 55

Rep: Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546
Like I hinted at already in post #3 Evolution itself has a switch to force closing it down. Such a switch would not exist if the developers meant it in the Sledge Hammer "Trust me, I know what I'm doing." kind of way.
 
1 members found this post helpful.
  


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
[SOLVED] Bash; terminate sourced script without closing its shell porphyry5 Programming 16 07-13-2012 12:39 PM
Starting GUI on specific workspace from CLI or shell script PClOStinspace Linux - Newbie 5 05-23-2011 08:50 PM
[SOLVED] starting shell script in GUI qrange Linux - Software 7 01-11-2011 11:34 AM
Starting my first shell script. visle Programming 8 03-29-2010 06:41 AM
Starting a program from a shell script Suinatsa Programming 2 04-17-2005 12:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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