Re: Script vs command line behaviour

2016-10-15 Thread Henrique de Moraes Holschuh
On Sat, 15 Oct 2016, Andre Majorel wrote: > Or is pkill more than a wrapper around kill(pid, 15) and > kill(pid, 9) ? pkill is quite less prone to killing the wrong process due to a race when you use it properly. In the general case one should avoid SIGKILL. Trying other signals that allow for

Re: Script vs command line behaviour

2016-10-15 Thread Andre Majorel
On 2016-10-12 08:40 -0400, Greg Wooledge wrote: > On Wed, Oct 12, 2016 at 09:34:22PM +0900, Mark Fletcher wrote: > > # The systemctl stop for svnserve may not work as I haven't got around to > > # making a stop script for it. > > # So kill the process the old fashioned way > > ps -ef | grep

Re: Script vs command line behaviour

2016-10-13 Thread Henrique de Moraes Holschuh
On Thu, 13 Oct 2016, Mark Fletcher wrote: > but I don't completely understand what you mean. Are you saying that, > even though the command to start fetchmail is not an invokation of a > systemd unit, the fact that it is happening from inside a script that is > run by a systemd unit somehow

Re: Script vs command line behaviour

2016-10-13 Thread Mark Fletcher
On Thu, Oct 13, 2016 at 04:55:06PM +0200, Nicolas George wrote: > Le duodi 22 vendémiaire, an CCXXV, Mark Fletcher a écrit : > > > strace -f -e execve -s 1 -o /tmp/my_script.$$.$(date +%Y%m%d%H%M%S) & > > > But there is no my_script. in /tmp... WhaFu? > > My bad, I forgot the end of the

Re: Script vs command line behaviour

2016-10-13 Thread Nicolas George
Le duodi 22 vendémiaire, an CCXXV, Mark Fletcher a écrit : > > strace -f -e execve -s 1 -o /tmp/my_script.$$.$(date +%Y%m%d%H%M%S) & > But there is no my_script. in /tmp... WhaFu? My bad, I forgot the end of the command: -p $$ (insert just before the final ampersand) Command explained:

Re: Script vs command line behaviour

2016-10-13 Thread Mark Fletcher
On Wed, Oct 12, 2016 at 05:17:20PM +0200, Nicolas George wrote: > You can debug what happens to your script by adding this line near the > beginning: > > strace -f -e execve -s 1 -o /tmp/my_script.$$.$(date +%Y%m%d%H%M%S) & > > Tomorrow, the file in /tmp will tell you what happened. > OK I

Re: Script vs command line behaviour

2016-10-12 Thread Mark Fletcher
On Wed, Oct 12, 2016 at 04:29:01PM +0200, Nicolas George wrote: > Le primidi 21 vendémiaire, an CCXXV, Mark Fletcher a écrit : > > Fetchmail isn't set up as a service through systemd, although mysql and > > svnserve are. fetchmail is just started from this script (or supposed to > > be!) and

Re: Script vs command line behaviour

2016-10-12 Thread Mark Fletcher
On Wed, Oct 12, 2016 at 05:59:10PM +0200, Frank wrote: > Op 12-10-16 om 17:17 schreef Mark Fletcher: > >I wonder if passing the --fetchmailrc option will work. The systemd > >journal snippet I included in my original post shows that fetchmail is > >getting started successfully -- but by the

Re: Script vs command line behaviour

2016-10-12 Thread Mark Fletcher
On Wed, Oct 12, 2016 at 04:51:40PM -0400, Jude DaShiell wrote: > ># and restart the services we stopped > >systemctl start svnserve > >systemctl start mysql > >sudo -u mark fetchmail -d 900 > > > I think the issue revolves around unknown pwd. Perhaps running fetchmail as > the user rather than

Re: Script vs command line behaviour

2016-10-12 Thread Jude DaShiell
On Wed, 12 Oct 2016, Mark Fletcher wrote: Date: Wed, 12 Oct 2016 08:34:22 From: Mark Fletcher <mark2...@gmail.com> To: debian-user@lists.debian.org Subject: Script vs command line behaviour Resent-Date: Wed, 12 Oct 2016 12:34:43 + (UTC) Resent-From: debian-user@lists.debian.org Gre

Re: Script vs command line behaviour

2016-10-12 Thread Frank
Op 12-10-16 om 17:17 schreef Mark Fletcher: I wonder if passing the --fetchmailrc option will work. The systemd journal snippet I included in my original post shows that fetchmail is getting started successfully -- but by the morning it's not running. Now, clearly nothing gets past me, but that

Re: Script vs command line behaviour

2016-10-12 Thread Nicolas George
Le duodi 22 vendémiaire, an CCXXV, Mark Fletcher a écrit : > You bring up a good point, actually. I'm calling systemctl stop and > systemctl start to stop and start mysql -- and I'm doing that in a > script that is itself being called by a systemd unit (the one triggered > by the timer). I

Re: Script vs command line behaviour

2016-10-12 Thread Mark Fletcher
On Wed, Oct 12, 2016 at 10:36:40AM -0400, Gene Heskett wrote: > On Wednesday 12 October 2016 09:40:57 Mark Fletcher wrote: > > > On Wed, Oct 12, 2016 at 08:40:12AM -0400, Greg Wooledge wrote: > > > On Wed, Oct 12, 2016 at 09:34:22PM +0900, Mark Fletcher wrote: > > > > # The systemctl stop for

Re: Script vs command line behaviour

2016-10-12 Thread Darac Marjal
On Thu, Oct 13, 2016 at 12:09:12AM +0900, Mark Fletcher wrote: On Wed, Oct 12, 2016 at 04:29:01PM +0200, Nicolas George wrote: Le primidi 21 vendémiaire, an CCXXV, Mark Fletcher a écrit : > Fetchmail isn't set up as a service through systemd, although mysql and > svnserve are. fetchmail is just

Re: Script vs command line behaviour

2016-10-12 Thread Mark Fletcher
On Wed, Oct 12, 2016 at 04:29:01PM +0200, Nicolas George wrote: > Le primidi 21 vendémiaire, an CCXXV, Mark Fletcher a écrit : > > Fetchmail isn't set up as a service through systemd, although mysql and > > svnserve are. fetchmail is just started from this script (or supposed to > > be!) and

Re: Script vs command line behaviour

2016-10-12 Thread Gene Heskett
On Wednesday 12 October 2016 09:40:57 Mark Fletcher wrote: > On Wed, Oct 12, 2016 at 08:40:12AM -0400, Greg Wooledge wrote: > > On Wed, Oct 12, 2016 at 09:34:22PM +0900, Mark Fletcher wrote: > > > # The systemctl stop for svnserve may not work as I haven't got > > > around to # making a stop

Re: Script vs command line behaviour

2016-10-12 Thread Nicolas George
Le primidi 21 vendémiaire, an CCXXV, Mark Fletcher a écrit : > Fetchmail isn't set up as a service through systemd, although mysql and > svnserve are. fetchmail is just started from this script (or supposed to > be!) and launched by hand from the command line when that fails. > > So at least

Re: Script vs command line behaviour

2016-10-12 Thread Mark Fletcher
On Wed, Oct 12, 2016 at 09:56:06AM -0400, Greg Wooledge wrote: > On Wed, Oct 12, 2016 at 10:40:57PM +0900, Mark Fletcher wrote: > > ...Any thoughts on what is preventing the restart of fetchmail from > > working? > > Nothing in particular. I haven't used fetchmail in many years, and > never as

Re: Script vs command line behaviour

2016-10-12 Thread Mark Fletcher
On Wed, Oct 12, 2016 at 08:40:12AM -0400, Greg Wooledge wrote: > On Wed, Oct 12, 2016 at 09:34:22PM +0900, Mark Fletcher wrote: > > # The systemctl stop for svnserve may not work as I haven't got around to > > # making a stop script for it. > > # So kill the process the old fashioned way > > ps

Re: Script vs command line behaviour

2016-10-12 Thread Greg Wooledge
On Wed, Oct 12, 2016 at 10:40:57PM +0900, Mark Fletcher wrote: > ...Any thoughts on what is preventing the restart of fetchmail from > working? Nothing in particular. I haven't used fetchmail in many years, and never as a "service" at the system level. So, just general thoughts: 1) Use

Re: Script vs command line behaviour

2016-10-12 Thread Frédéric Marchal
On Wednesday 12 October 2016 08:40:12 Greg Wooledge wrote: > And stop using -9 (SIGKILL). Forever. Pretend it never existed. That's a bit harsh. The tool exists for a good reason :-) "Unix was not designed to stop you from doing stupid things, because that would also stop you from doing

Re: Script vs command line behaviour

2016-10-12 Thread Greg Wooledge
On Wed, Oct 12, 2016 at 09:34:22PM +0900, Mark Fletcher wrote: > # The systemctl stop for svnserve may not work as I haven't got around to > # making a stop script for it. > # So kill the process the old fashioned way > ps -ef | grep svnserve | grep -v grep | awk '{print $2}' | xargs kill -9

Script vs command line behaviour

2016-10-12 Thread Mark Fletcher
Greetings I am observing a strange behaviour and I am wondering what stupid thing I have done that is causing it. A shell command that is supposed to start fetchmail running every 15 minutes works fine run from the command line, but has no effect when run from inside a script. I am running