User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Scripting help

Thu Oct 31, 2013 9:26 pm

I have a script which runs some cronjobs and then shuts down the pi. The script is initiated at boot time. Boot time is initiated by an electronic timer switch which can have many on's and off's.

I would like that script to run at a particular time. For example on boot:

If time is greater than 03:00and less than 06:00 then
run cronjob script
else
end

In other words only run the cron jobs between 03:00 and 06:00. At any other time just boot normally and ignore the script.

I want the pi to be booted during the night to do some backing up then shutdown. At any other time the pi does not shut down after booting.

Can anyone help or suggest another perhaps more simple way to achieve this?

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: Scripting help

Thu Oct 31, 2013 9:58 pm

I have cobbled together this:

begin=$(date --date="3:00" +%s)
end=$(date --date="6:00" +%s)
now=$(date +%s)
if [ "$begin" -le "$now" -a "$now" -le "$end" ]; then
#run cronbjob script
fi

But if it is true then the script will not end correctly as the pi will shut down.

JustThisGuy
Posts: 114
Joined: Thu Jan 05, 2012 11:22 pm

Re: Scripting help

Thu Oct 31, 2013 11:22 pm

Let's see if I have this straight.

You have an electrical timer which turns the power supply for the RPi on and off at various times during the day.
(when the timer turns off power how are you assuring a smooth shutdown?)(how many times a day does the timer boot the RPi?)
When the RPi boots and it is between 3am and 6am you want it to back itself up and shutdown.
At any other time you want to do nothing in particular and continue running.

Is that about it?

Also I'm a tad confused regarding cronjobs. I'm an old school guy and to me cron is one of the standard services available on *nix. By filling in the details in a file called crontab you run a named script at a particular time and particular date, like 11:23 18/10/2014, or repeated like 11:23 on the first of every month for example. In that light, talking about running cronjobs from a script is new to me. Could you explain more?

First thing though, unless you really really need the RPi to go up and down an awful lot I would suggest to leave it up as much as possible. Or even longer.

But what it sounds like to me is that you need a plain old sh script that gets run at boot (using the sysvinit rc system, the current standard method of running something at boot) and if it is between 3 and 6 in the morning do the back up and shutdown. Problem solved.

If you could leave the RPi up all the time then you could use cron to run a backup script every night some time between 3 & 6am. Again problem solved.

It might help to know why the RPi is going up and down so often.
Any conversation about a sufficiently complex subject is indistinguishable from babble.

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: Scripting help

Fri Nov 01, 2013 9:38 am

I have a script called shutauto:

!#/bin/bash
/usr/bin/rsync -avx --delete /media/HDD1/shares/myprofile /media/HDD2/share$
/usr/bin/rsync -avx --delete /media/HDD1/shares/hanprofile /media/HDD2/shar$
/usr/bin/rsync -avx --delete /media/HDD1/shares/mailwasher /media/HDD2/shar$
/usr/bin/rsync -avx --delete /media/HDD1/shares/archive /media/HDD2/shares/
/sbin/shutdown -h 25

It is located in /usr/local/bin

-rwxr-xr-x 1 root staff 371 Oct 30 21:21 shutauto

I have added a line before the exit 0 in /etc/rc.local

/usr/local/bin/shutauto

So,when the timer powers on the pi it carries out the backup from HDD1 to HDD2 and then the pi shuts down.

The power supply is set for a 2 hour period which more than covers the time the pi would be running the backup. So the pi shuts down gracefully.

I would like to feed data from two pc's to the HDD1 at 19:05 each day but not run the backup from HDD1 to HDD2 at that time.

I use a Windows 7 backup program to feed that data which is triggered automatically by a Scheduled Task at 7:05. This task runs for less than 2 hours and the power supply would turn on at 19:00 and off again at 21:00.

In the main I only need to access the pi manually in the evening so at any time before the shutdown is due I could issue a sudo pkill shutdown to stop the automatic shutdown and allow me to do whatever. Later I could issue a sudo shutdown -h now to manually shut the pi down.

When everything is running correctly I never use the pi manually. It just does it's backups and I forget it for weeks at a time.

However I have been 'losing' one or the other HDD on odd occasions. If this happens to HDD1, the Windows backup program warns me. If it happens to HDD2 then I get no warning, however, I am looking into having an email sent if the backup from HDD1 to HDD2 fails. But that is a step to far at the moment as is determining why the HDDs get 'lost'. 'Lost' as in when Windows HDs or partitions are not in the list and a reboot brings it/them back.

I hope this clarifies what I would like to achieve and thanks for taking the time look at this.

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: Scripting help

Fri Nov 01, 2013 4:45 pm

Perhaps this explains also, (assuming the code is correct):

!#/bin/bash

begin=$(date --date="3:00" +%s)
end=$(date --date="6:00" +%s)
now=$(date +%s)

if [ "$begin" -le "$now" -a "$now" -le "$end" ]; then

/usr/bin/rsync -avx --delete /media/HDD1/shares/myprofile /media/HDD2/shares/
/usr/bin/rsync -avx --delete /media/HDD1/shares/hanprofile /media/HDD2/shares/
/usr/bin/rsync -avx --delete /media/HDD1/shares/mailwasher /media/HDD2/shares/
/usr/bin/rsync -avx --delete /media/HDD1/shares/archive /media/HDD2/shares/
/sbin/shutdown -h 25
else

echo "don't do cronjobs"

fi
Last edited by makem2 on Fri Nov 01, 2013 10:23 pm, edited 1 time in total.

JustThisGuy
Posts: 114
Joined: Thu Jan 05, 2012 11:22 pm

Re: Scripting help

Fri Nov 01, 2013 8:24 pm

Thanks for the clarification.

It appears to me you are using the RPi as a backup appliance.

That script should run your rsyncs and immediately shutdown whenever the RPi boots between 3am and 6am. Whenever the RPi boots at any other time, it would print that "don't run the non cronjobs" and not shutdown. But only if you fix the conditionals.

It looks like you are using arithmetic conditionals (-le) on strings and the -a op is used only if you use the 'test' comparator. Use the '<=' for 'less than or equal to' and instead of '-a' use '&&'.
Any conversation about a sufficiently complex subject is indistinguishable from babble.

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: Scripting help

Fri Nov 01, 2013 10:33 pm

I found the comparison script here:

http://stackoverflow.com/questions/2899 ... te-command

I edited it using information from here:

http://codewiki.wikidot.com/shell-script:if-else

I tested the finished script here:

http://www.shellcheck.net/#

It said it was good!

At the moment I know the switch is working correctly as is the initial script. I have not yet had time to add the if comparison, then, else.

I will use your suggestion thank you.

Edit: But first I need to understand, "It looks like you are using arithmetic conditionals (-le) on strings and the -a op is used only if you use the 'test' comparator."

JustThisGuy
Posts: 114
Joined: Thu Jan 05, 2012 11:22 pm

Re: Scripting help

Fri Nov 01, 2013 11:35 pm

In bash, conditionals (the stuff between square brackets in the if statement) are of strange and wonderful construction. I don't use them often and when I do I always go back to the man page to verify. Of course the man page is strange and wonderful in its own right.

Here's a list of bash comparison operators: http://www.pyeung.com/pages/unix/linux/ ... ators.html

So if your script does the comparison correctly, ignore what I said. I was skimming over the man page and thought that might be a problem.
Any conversation about a sufficiently complex subject is indistinguishable from babble.

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: Scripting help

Sat Nov 02, 2013 9:08 am

I ran the setup in anger last night only this morning to have my wife ask why I left the TV on!

She had gone to bed earlier than I and got up earlier too, She said she heard someone talking and checked around the house only to find it was the TV!

I suppose, unless I can find some way of automatically controlling the HDMI output which turns on the TV, I will have to unplug it.

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: Scripting help

Sun Nov 03, 2013 1:10 pm

Found a setting in the TV settings: VIERA Link which when set to off stops the pi HDMI signal turning on the TV.

The if, then, else above works fine during the day which allows me to access the pi whenever I choose without having it shutdown automatically. I wait to see it it also does the rsync jobs at 03:00 but I think it will.

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: Scripting help

Sat Nov 09, 2013 9:07 pm

Can I ask help with nesting two timed schedules:

Code: Select all

!#/bin/bash

begin=$(date --date="19:00" +%s)
end=$(--date="21:00" +%s)
now=$(date +%s)

if [ "$begin" -le "$now" -a "$now" -le "$end" ]; then

         at 20:55 /sbin/shutdown -h 25

else

         begin=$(date --date="3:00" +%s)
         end=$(date --date="6:00" +%s)
         now=$(date +%s)

if [ "$begin" -le "$now" -a "$now" -le "$end" ]; then

         /usr/bin/rsync -avx --delete /media/HDD1/shares/myprofile /media/HDD2/shares/
         /usr/bin/rsync -avx --delete /media/HDD1/shares/hanprofile /media/HDD2/shares/
         /usr/bin/rsync -avx --delete /media/HDD1/shares/mailwasher /media/HDD2/shares/
         /usr/bin/rsync -avx --delete /media/HDD1/shares/archive /media/HDD2/shares/
         /sbin/shutdown -h 25

else

         echo "don't do cronjobs"

fi


I need to check if the time is between 19:00 and 21:00 - if it is then at 20:55 /sbin/shutdown -h 25 using the Linux 'at' command

If the time is not between 19:00 and 21:00 then check if the time is between 03:00 and 06:00 - if so then do /usr/bin/rsync jobs then /sbin/shutdown -h 25

If not then just echo something and fi
Last edited by makem2 on Sun Nov 10, 2013 10:56 am, edited 2 times in total.

User avatar
rpdom
Posts: 16755
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Scripting help

Sun Nov 10, 2013 2:55 am

The "at" command syntax is wrong.

It isn't "at <timespec> <command(s)>", it is "at <timespec> (run command(s) given on STDIN)".

So you'd need something like:

Code: Select all

at 20:55 <<ENDTAG
/sbin/shutdown -h 25
ENDTAG
or

Code: Select all

echo "/sbin/shutdown -h 25" | at 20:55
PS. When posting scripts, try clicking the Code formatting button and put your code inside the tags provided (like I did). It makes the code more readable and preserves any indents. :)

User avatar
emgi
Posts: 357
Joined: Thu Nov 07, 2013 4:08 pm
Location: NL

Re: Scripting help

Sun Nov 10, 2013 9:45 am

Here is an alternative way to do at least the first part of the job.
Instead of the startup script you can create a "real" cronjob which runs daily at 20:55.
This script should look like this:

Code: Select all

runtime=$(</proc/uptime)
runtime=${runtime%%.*}
#echo $runtime (for debugging purposes)

if [ "$runtime" -le "7200" ]; then
 echo "shutdown"
fi
Basically what this does it that it checks the number of seconds since boot. If this is less than 2hrs ago, we obviously started after 19:00. In that case, the shutdown script will be executed.

/emgi

User avatar
exartemarte
Posts: 373
Joined: Sat Mar 03, 2012 3:51 pm
Location: Middle England
Contact: Website

Re: Scripting help

Sun Nov 10, 2013 10:28 am

Unless I've missed something, this does seem to be an over complicated solution to a simple problem. Why use an external device to switch a Pi on and off when the Pi can run 24/7, using very little power, and do what you want whenever you want it done? (If you needed a device to switch something on and off automatically you might well choose a Pi to do the job!)

I have a headless Pi-based NAS server running continuously. It stores stuff on disc 1. At 3.30 every morning, on a cron job, it copies anything new or changed to disc 2. Simples...

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: Scripting help

Sun Nov 10, 2013 10:41 am

exartemarte wrote:Unless I've missed something, this does seem to be an over complicated solution to a simple problem. Why use an external device to switch a Pi on and off when the Pi can run 24/7, using very little power, and do what you want whenever you want it done? (If you needed a device to switch something on and off automatically you might well choose a Pi to do the job!)

I have a headless Pi-based NAS server running continuously. It stores stuff on disc 1. At 3.30 every morning, on a cron job, it copies anything new or changed to disc 2. Simples...
You are quite right and I used to run mine 24/7 doing exactly as you say. However for a few lines of code I can save money and a little part of the planet. However minute, these savings add up across the world. Besides which, I learn and that too is important to me.

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: Scripting help

Sun Nov 10, 2013 10:48 am

emgi wrote:Here is an alternative way to do at least the first part of the job.
Instead of the startup script you can create a "real" cronjob which runs daily at 20:55.
This script should look like this:

Code: Select all

runtime=$(</proc/uptime)
runtime=${runtime%%.*}
#echo $runtime (for debugging purposes)

if [ "$runtime" -le "7200" ]; then
 echo "shutdown"
fi
Basically what this does it that it checks the number of seconds since boot. If this is less than 2hrs ago, we obviously started after 19:00. In that case, the shutdown script will be executed.

/emgi
I fail to see how this will differentiate between the boot at 19:00 and that at 03:00. Would it not also check if the run time is less than 2 hours after 03:00?

I have a feeling I might have missed something though.

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: Scripting help

Sun Nov 10, 2013 11:14 am

rpdom wrote:The "at" command syntax is wrong.

It isn't "at <timespec> <command(s)>", it is "at <timespec> (run command(s) given on STDIN)".

So you'd need something like:

Code: Select all

at 20:55 <<ENDTAG
/sbin/shutdown -h 25
ENDTAG
or

Code: Select all

echo "/sbin/shutdown -h 25" | at 20:55
PS. When posting scripts, try clicking the Code formatting button and put your code inside the tags provided (like I did). It makes the code more readable and preserves any indents. :)
I have used your latter suggestion and taken on board your 'Code' advice. I get the errors marked below.

Code: Select all

!#/bin/bash

begin=$(date --date="19:00" +%s)
end=$(--date="21:00" +%s)
now=$(date +%s)

if [ "$begin" -le "$now" -a "$now" -le "$end" ]; then
 ^––
Couldn't find 'fi' for this 'if'.
^––
Couldn't parse this if expression.


	echo "/sbin/shutdown -h 25" | at 20:55

else

	begin=$(date --date="3:00" +%s)
	end=$(date --date="6:00" +%s)
	now=$(date +%s)

if [ "$begin" -le "$now" -a "$now" -le "$end" ]; then

	/usr/bin/rsync -avx --delete /media/HDD1/shares/myprofile /media/HDD2/shares/
	/usr/bin/rsync -avx --delete /media/HDD1/shares/hanprofile /media/HDD2/shares/
	/usr/bin/rsync -avx --delete /media/HDD1/shares/mailwasher /media/HDD2/shares/
	/usr/bin/rsync -avx --delete /media/HDD1/shares/archive /media/HDD2/shares/
	/sbin/shutdown -h 25

else

	echo "don't do cronjobs"

fi
^––
Expected 'fi' matching previously mentioned 'if'.
^––
Unexpected eof. Fix any mentioned problems and try again.

User avatar
rpdom
Posts: 16755
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Scripting help

Sun Nov 10, 2013 12:06 pm

I just tried copy/pasting your code and running it, with minor modifications - I don't want it shutting down the system I'm testing it on :o

The first line !#/bin/bash should be #!/bin/bash I don't know how you're getting it to do anything at all with that wrong???

Line 4. The "date" command is missing.

The "fi" is missing from the first "if;then;else" block. Try this code instead

Code: Select all

#!/bin/bash

begin=$(date --date="19:00" +%s)
end=$(date --date="21:00" +%s)
now=$(date +%s)

if [ "$begin" -le "$now" -a "$now" -le "$end" ]
then

    echo "/sbin/shutdown -h 25" | at 20:55 

else

    begin=$(date --date="3:00" +%s)
    end=$(date --date="6:00" +%s)
    now=$(date +%s)

    if [ "$begin" -le "$now" -a "$now" -le "$end" ]
    then

        /usr/bin/rsync -avx --delete /media/HDD1/shares/myprofile /media/HDD2/shares/
        /usr/bin/rsync -avx --delete /media/HDD1/shares/hanprofile /media/HDD2/shares/
        /usr/bin/rsync -avx --delete /media/HDD1/shares/mailwasher /media/HDD2/shares/
        /usr/bin/rsync -avx --delete /media/HDD1/shares/archive /media/HDD2/shares/
        /sbin/shutdown -h 25

    else

        echo "don't do cronjobs"
    fi
fi
Caveat: I haven't tested this at all. There may be errors I haven't spotted.

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: Scripting help

Sun Nov 10, 2013 1:23 pm

Sorry about the typos.

Thanks for the help. The script checks out at:

http://www.shellcheck.net/#

I will use it.

User avatar
emgi
Posts: 357
Joined: Thu Nov 07, 2013 4:08 pm
Location: NL

Re: Scripting help

Sun Nov 10, 2013 1:41 pm

makem2 wrote:
emgi wrote:Here is an alternative way to do at least the first part of the job.
Instead of the startup script you can create a "real" cronjob which runs daily at 20:55.
This script should look like this:

Code: Select all

runtime=$(</proc/uptime)
runtime=${runtime%%.*}
#echo $runtime (for debugging purposes)

if [ "$runtime" -le "7200" ]; then
 echo "shutdown"
fi
Basically what this does it that it checks the number of seconds since boot. If this is less than 2hrs ago, we obviously started after 19:00. In that case, the shutdown script will be executed.

/emgi
I fail to see how this will differentiate between the boot at 19:00 and that at 03:00. Would it not also check if the run time is less than 2 hours after 03:00?

I have a feeling I might have missed something though.
Obviously you do! ;)
You refer to your scripts as "cron jobs" whereas they are only run once, namely upon boot. I would rather call that a startup script.
That is not the same. Cron jobs can be scheduled to run at any given time of day (and more).
http://www.adminschoice.com/crontab-quick-reference/
The way I envisioned this was that the suggested job should run once per day, at 20:55. If the Pi is not running at that time, or longer than 2hrs, the shutdown would be skipped.
As this job doesn't run between 03:00 and 06:00, it does not affect what you do at that time. With a little bit of imagination you could probably also work out something similar for the second job.
Its just a matter of preference but I would attempt to use the crontab for all time related tasks.

One more thing:
The first line should be: #!/bin/bash, NOT !#/bin/bash :mrgreen:

/emgi

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: Scripting help

Mon Nov 11, 2013 12:43 am

rpdom wrote:I just tried copy/pasting your code and running it, with minor modifications - I don't want it shutting down the system I'm testing it on :o

The first line !#/bin/bash should be #!/bin/bash I don't know how you're getting it to do anything at all with that wrong???

Line 4. The "date" command is missing.

The "fi" is missing from the first "if;then;else" block. Try this code instead

Code: Select all

#!/bin/bash

begin=$(date --date="19:00" +%s)
end=$(date --date="21:00" +%s)
now=$(date +%s)

if [ "$begin" -le "$now" -a "$now" -le "$end" ]
then

    echo "/sbin/shutdown -h 25" | at 20:55 

else

    begin=$(date --date="3:00" +%s)
    end=$(date --date="6:00" +%s)
    now=$(date +%s)

    if [ "$begin" -le "$now" -a "$now" -le "$end" ]
    then

        /usr/bin/rsync -avx --delete /media/HDD1/shares/myprofile /media/HDD2/shares/
        /usr/bin/rsync -avx --delete /media/HDD1/shares/hanprofile /media/HDD2/shares/
        /usr/bin/rsync -avx --delete /media/HDD1/shares/mailwasher /media/HDD2/shares/
        /usr/bin/rsync -avx --delete /media/HDD1/shares/archive /media/HDD2/shares/
        /sbin/shutdown -h 25

    else

        echo "don't do cronjobs"
    fi
fi
Caveat: I haven't tested this at all. There may be errors I haven't spotted.
Did the echo "/sbin/shutdown -h 25" | at xxxx work?

It didn't for me. That meant the pi was still active when the power was turned off rather than shutting down before.

It didn't work from a command prompt either. There was a warning but that is all. I think the warning was related to the shell.

User avatar
rpdom
Posts: 16755
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Scripting help

Mon Nov 11, 2013 5:16 am

makem2 wrote:Did the echo "/sbin/shutdown -h 25" | at xxxx work?
Well, I didn't try it with the shutdown command, like I said I didn't want to shut down the system I was using at the time :o

But I have just done a quick test from the command line with

Code: Select all

echo "touch /tmp/fred" | at 05:00
Then waited a couple of minutes, and

Code: Select all

ls -l /tmp/fred
-rw-r--r-- 1 dom  dom       0 Nov 11 05:00 fred
It worked.

The warning you see is normal. It just means that the command will be run using the /bin/sh shell, rather than whatever shell you are currently using.

It *should* work. If there were any errors when the command was run, you would get a mail message if a mail client and MTA were installed and configured. I'm not sure where messages would be sent otherwise. There might be something in /var/log/syslog, var/log/messages or /var/log/daemon.log

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: Scripting help

Mon Nov 11, 2013 10:47 am

rpdom wrote:
makem2 wrote:Did the echo "/sbin/shutdown -h 25" | at xxxx work?
Well, I didn't try it with the shutdown command, like I said I didn't want to shut down the system I was using at the time :o

But I have just done a quick test from the command line with

Code: Select all

echo "touch /tmp/fred" | at 05:00
Then waited a couple of minutes, and

Code: Select all

ls -l /tmp/fred
-rw-r--r-- 1 dom  dom       0 Nov 11 05:00 fred
It worked.

The warning you see is normal. It just means that the command will be run using the /bin/sh shell, rather than whatever shell you are currently using.

It *should* work. If there were any errors when the command was run, you would get a mail message if a mail client and MTA were installed and configured. I'm not sure where messages would be sent otherwise. There might be something in /var/log/syslog, var/log/messages or /var/log/daemon.log
I have checked those logs and the only references which may be of use are:

Nov 11 03:01:43 raspberrypi kernel: [ 28.499656] CIFS: no cache= option specified, using "cache=loose". This default will change to "cache=strict" in 3.7.
Nov 11 03:01:43 raspberrypi kernel: [ 29.775219] smsc95xx 1-1.1:1.0: eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1
Nov 11 03:01:43 raspberrypi kernel: [ 34.544048] CIFS VFS: Error connecting to socket. Aborting operation
Nov 11 03:01:43 raspberrypi kernel: [ 34.544303] CIFS VFS: cifs_mount failed w/return code = -113
Nov 11 03:01:43 raspberrypi kernel: [ 40.564041] CIFS VFS: Error connecting to socket. Aborting operation
Nov 11 03:01:43 raspberrypi kernel: [ 40.566010] CIFS VFS: cifs_mount failed w/return code = -113
Nov 11 03:01:43 raspberrypi kernel: [ 49.654072] CIFS VFS: Error connecting to socket. Aborting operation
Nov 11 03:01:43 raspberrypi kernel: [ 49.655990] CIFS VFS: cifs_mount failed w/return code = -113
Nov 11 03:01:43 raspberrypi kernel: [ 55.674074] CIFS VFS: Error connecting to socket. Aborting operation
Nov 11 03:01:43 raspberrypi kernel: [ 55.674322] CIFS VFS: cifs_mount failed w/return code = -113
Nov 11 03:01:45 raspberrypi /usr/sbin/cron[2253]: (CRON) INFO (pidfile fd = 3)
Nov 11 03:01:45 raspberrypi /usr/sbin/cron[2256]: (CRON) STARTUP (fork ok)
Nov 11 03:01:45 raspberrypi /usr/sbin/cron[2256]: (CRON) INFO (Running @reboot jobs)


Nov 11 03:34:54 raspberrypi kernel: [ 29.868523] CIFS VFS: cifs_mount failed w/return code = -6
Nov 11 03:34:54 raspberrypi kernel: [ 29.893320] CIFS VFS: cifs_mount failed w/return code = -6
Nov 11 03:34:54 raspberrypi kernel: [ 32.073400] CIFS VFS: cifs_mount failed w/return code = -6
Nov 11 03:34:54 raspberrypi kernel: [ 32.095444] CIFS VFS: cifs_mount failed w/return code = -6
Nov 11 03:34:55 raspberrypi /usr/sbin/cron[2219]: (CRON) INFO (pidfile fd = 3)
Nov 11 03:34:55 raspberrypi /usr/sbin/cron[2220]: (CRON) STARTUP (fork ok)
Nov 11 03:34:55 raspberrypi /usr/sbin/cron[2220]: (CRON) INFO (Running @reboot jobs)
Nov 11 03:34:56 raspberrypi kernel: [ 37.963407] Adding 102396k swap on /var/swap. Priority:-1 extents:1 across:102396k SS

The mail log only warns of an error on 30th October.

I will look for help installing a mail client and MTA.

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: Scripting help

Mon Nov 11, 2013 11:36 am

I have set up a mail server using:

http://www.ducky-pond.com/posts/2012/Ju ... el-on-rpi/

Not sure if errors will come there as I don't know yet what domain to use.

EDIT: Should have been a client! :oops:

But, it was interesting :)

Installing mutt:

http://dcoj.wmh3.com/geekstuff/pisu/2.html

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: Scripting help

Mon Nov 11, 2013 12:47 pm

Test:

$ echo "/sbin/shutdown -h 15" | at 12:30
warning: commands will be executed using /bin/sh
job 3 at Mon Nov 11 12:30:00 2013


Previously a "/sbin/shutdown -h 25" would evoke a warning 15 minutes before shutdown followed by further warnings. So I awaited a warning before 12:45.

12:45 came and went, no warnings, no shutdown, no mail warning of any error, so mail not working - MTA needed?

Return to “Raspberry Pi OS”