[SOLVED] - Still some problems to fix


Recommended Posts

Hello everybody, Installed unraid about a week ago and still setting everything up.

 

I'm using unraid 5 rc11 with SimpleFeatures v1.0.11. One thing I still want is automatic power management. So when it's idle for lets say one hour it goes to sleep. This I've got working using "SimpleFeatures Settings" => "Sleep Mode".

 

But now I also want the server to shutdown at 1:00 am. So first of all, I assume it is awake at that time (so it's not in sleep). How do I tell my server. U need to shutdown @ 1 am? I thought it wasn't that hard. Thought all I had to do is modify my go file and reboot the server. : https://dl.dropbox.com/u/64092960/server-shutdown.jpg . But strange enough it doesn't work :/ .

(And why are there strange symbols @ the end of those lines :S )

 

 

If I get te above thing working. i have another problem. What if my server is sleeping (s3) when it's time to go into shutdown. I think he won't remember it. So, is there a way to wake the server up at a specific time?

 

 

(If it isn't possible, I can always use my raspberry pi to send a wol package 10 minutes before he needs to go in shutdown.)

 

 

 

Hope somebody can help me

 

Thanks in advance

 

 

edit: I still have another problem. I save all the familie pictures and movies on my server. I don't want data corruption, so I want to run once in two weeks (or maybe a month) an md5sum check on those files. I know how to do this.

 

I need to run one time:

 

find /the/directory/to/scan -type f -print0 | xargs -0 md5sum >> file.md5

 

And from than on, I need to run:

 

md5sum -c /path/to/file.md5

 

This will report if checksum changed. The only thing I need to do is automate this "md5sum -c /path/to/file.md5" , so it runs once in two weeks. And I also want to have email notification, if everything is okay , or not. (if it's possible)

 

(my email notification is already working for the unraid server)

 

 

 

 

Link to comment

Those lines where generated by the server itself. Maybe because I opened it in a telnet connection :S. But that's not the 'big' problem. But thanks for your reply :)

 

edit: I've removed it :)

 

edit2: found this to mail output from a command:

 

<comand> | mail -s <subject> <email address> 

 

(but my terminal says -bash: mail: command not found)

 

edit3:

 

md5sum -c /path/to/file.md5 | ssmtp [email protected]

 

Sends an e-mail, but it's empty :(. (even if I get an error that files didn't match in terminal.)

 

edit4:

cat file.md5 | ssmtp -d root ( I get an email with all md5sums of every file)

 

But when I do:  md5sum -c file.md5 >>afile.tmp

Followed by

cat afile.tmp | ssmtp -d root

(I get an empty mail :( , and afile.tmp isn't emprty :(, it shows where the errors are )

 

 

Link to comment

Those lines where generated by the server itself. Maybe because I opened it in a telnet connection :S. But that's not the 'big' problem. But thanks for your reply :)

...

You said you edited the go file. If you used Notepad then it put the ^M on even those lines that you didn't change.  This doesn't break the go file, but if you try to edit some other unRAID OS files from Windows using Notepad they will be broken. Get a Linux compatible text editor and you will save yourself trouble in the future. Search for Notepad++, it's free.

 

Link to comment

Okay thank you :) (althought I used VI in puttytel :S )

Somebody got a solution for my other problems :P

 

 

edit: got something working.

For the md5sum problem I have wrote a script (the script is located on a user share, if this is important):

md5sum -c file.md5 > newmd5sums.tmp

 

grep -i -c  failed newmd5sums.tmp>> mail.tmp

 

sed -e 's/$/ error(s) found, check newmd5sums.tmp when errors found/' -i mail.tmp

 

cat mail.tmp | ssmtp  root

 

rm mail.tmp"

 

Now I get a mail:  x error(s) found, check /mnt/user/settingshare/md5checker/newmd5sums.tmp when errors found. (where x is the number of errors) Does anybody know how to set a subject for ssmtp? Can't find it :S

 

(found this: echo -e "Subject: another test\n\nThis is the email body." | ssmtp -d root , but don't know how to combine it with    cat mail.tmp | ssmtp  root )

 

 

Thanks

 

 

edit2:

I know if I manually add :

15 7 2 * * . /mnt/user/settingshare/md5checker/scriptmd5sum

 

15 7 17 * * . /mnt/user/settingshare/md5checker/scriptmd5sum

to my crontab file it works. The problem is, that when I reboot, they are removed from the crontab. Does anybody got a fix for this?

 

My go file looks like this:

#!/bin/bash

# Start the Management Utility

/usr/local/sbin/emhttp

 

 

 

crontab -l >/tmp/crontab

echo "15 7 2 * * . /mnt/user/settingshare/md5checker/scriptmd5sum" >>/tmp/crontab

echo "15 7 17 * * . /mnt/user/settingshare/md5checker/scriptmd5sum" >>/tmp/crontab

crontab /tmp/crontab

 

But after a reboot, if I do crontab -l , the commands aren't there :(

 

I can manually run the go script. it gives back : "segmentation fault"

But after that the entries are added to the crontab. (but after a reboot they are gone again :'( )

 

Please help

 

 

Link to comment

you cannot re-run the config/go script, since you cannot re-run emhttp.

 

The "go" script is not directly executed.  In /etc/rc.local it is copied to /var/tmp/go from the flash drive after being passed through "fromdos" to delete MS-DOS carriage returns.

 

Then, the file in /var/tmp/go is made executable and executed.

 

You need to look in the /var/tmp/go file to see what is being invoked.

 

I suspect it will provide clues. 

 

As far as mail goes, "ssmtp" is a mail transfer agent.  You cannot use an argument to add a subject, as the subject is part of the mail content itself  (in the first few lines of the header of the mail) piped to it.  You need to install and use a mail program (or something that acts as one) in combination with a mail transfer agent.  I personally use mailx in combination with sendmail. (installed through unMENU's package manager) 

Link to comment

These two lines will likely be an issue once you can get the lines in cronntab.

echo "15 7 2 * * . /mnt/user/settingshare/md5checker/scriptmd5sum" >>/tmp/crontab

echo "15 7 17 * * . /mnt/user/settingshare/md5checker/scriptmd5sum" >>/tmp/crontab

They will work only if you are at "/"  (current working directory is "/")

Nowhere else will ./mnt be valid.

You probably want

echo "15 7 2 * *  /mnt/user/settingshare/md5checker/scriptmd5sum" >>/tmp/crontab

echo "15 7 17 * *  /mnt/user/settingshare/md5checker/scriptmd5sum" >>/tmp/crontab

Link to comment

First of all thank you for replying :)

 

Here are the permissions and a cat from the /var/tmp/go file:

https://dl.dropbox.com/u/64092960/unraid/unraid1.jpg

https://dl.dropbox.com/u/64092960/unraid/unraid2.jpg

 

If I (manually) put echo "15 7 2 * *  /mnt/user/settingshare/md5checker/scriptmd5sum" >>/tmp/crontab without the . isn't executed. I fin dthis also strange. Don't know why this is :S

 

without the . I get this in my system log

 

Mar 2 18:20:16 Tower crond[1156]: exit status 126 from user root /mnt/user/settingshare/md5checker/scriptmd5sum

Mar 2 18:20:16 Tower crond[14637]: unable to exec /usr/sbin/sendmail: cron output for user root /mnt/user/settingshare/md5checker/scriptmd5sum to /dev/null

 

with the . before that line everything works. (When I manually add that line to crontab)

Link to comment

First of all thank you for replying :)

 

Here are the permissions and a cat from the /var/tmp/go file:

https://dl.dropbox.com/u/64092960/unraid/unraid1.jpg

https://dl.dropbox.com/u/64092960/unraid/unraid2.jpg

 

If I (manually) put echo "15 7 2 * *  /mnt/user/settingshare/md5checker/scriptmd5sum" >>/tmp/crontab without the . isn't executed. I fin dthis also strange. Don't know why this is :S

 

without the . I get this in my system log

 

Mar 2 18:20:16 Tower crond[1156]: exit status 126 from user root /mnt/user/settingshare/md5checker/scriptmd5sum

Mar 2 18:20:16 Tower crond[14637]: unable to exec /usr/sbin/sendmail: cron output for user root /mnt/user/settingshare/md5checker/scriptmd5sum to /dev/null

 

with the . before that line everything works. (When I manually add that line to crontab)

The "." is a shorthand to execute the command with your current shell.  It cannot be used in crontab.

http://ss64.com/bash/period.html

 

The error you see is that sendmail is unable to be executed.    Does it even exist on your server?  Does it exist at the time your cron job runs?  Is it execuitable?  (pretty sure cron will not use a shell to invoke it, but insists on a real executable.  It is why I ended up using a compiles ssmtp and sendmail.)

 

Joe L.

 

 

Link to comment

I Don't Have Sendmail Installed On My Server. If I Isntall Iit, Will My Problem With The Go Script Be Fixed? And Yes If I Dont Use The . I Get That Error ;) IS There A Tutorial Or Wiki On How To Install Sendmail?

 

Thanks :)

 

I've Installed Simple Features With all Addons (Without Itunes ServerAnd Web Server) So I Think I've Only Ssmtp. I can say that my system notification is working. I get emails when there is something wrong with the server. But when I type "sendmail in the console , he says he doesn't know that command :(. (sorry I'm an absolute linux noob)

 

edit: I followed this tutorial : http://lime-technology.com/forum/index.php?topic=15745.0

My system noticifaction still works. But how do I know if mailx/senmail is installed :S (sorry if this is a dumb question :S )

Or do I not need mailx? I'm a little bit confused :S. Since email notification can send emails with body and subject :S

Link to comment

Please note that the warning you get on syslog doesn't mean that the job is not running, just means that it is not mailing the output of the executed thing... if you handle mailing on the script itself you may not need to fix that anyway you need something like sendmail (I don't recommend it, it is overkill for what you need and I did tried to install it once on unraid and got some problems with it always telling me that there was no space on queue folder, despite there was... I guess maybe related to unraid running on a "live" filesystem...) or ssmtp anyway (and apparently you don't have it from the errors you posted above). There is a plugin on unMenu for mailx and ssmtp it may be the easiest way you get it.

 

Btw, you could maybe set a more appropriate title for this topic ;)

 

Edit: Opps, I did missed part of your posts, sorry, you apparently could run ssmtp then you must already have it. I did got the bad idea you didn't had it because of the errors when trying to run sendmail / mail and I guessed there should exist these as symlinks..

 

Edit2: Re mail subject you may use something like this:

echo -e "Subject: test\n\n`cat file.md5`" | ssmtp -d root

 

Link to comment

Wauw great. It works :) Now I can give my email a subject and it reports to me if errors where found ;). Now the only thing that I need to to is add the line automatically to crontab at boot. Somebody knows more about this? And the strange go-script problem

 

Thanks in advance

Link to comment

Sorry, my bad, I did just a quick search for it and found that... and think the red text was not there (?) and that post shows last edit: today... guess probably Joe L. just added it after my bad advice :)

 

Btw, I did just tested myself with lines similar to the ones you have to add new crontab lines from my go file and it works fine... and... when looking at your go file again I guess I did just found the cause of all your problem, you should have:

 

#!/bin/bash
# Start the Management Utility
/usr/local/sbin/emhttp &

crontab -l >/tmp/crontab
echo "15 7 2 * * /mnt/user/settingshare/md5checker/scriptmd5sum" >>/tmp/crontab
echo "15 7 17 * * /mnt/user/settingshare/md5checker/scriptmd5sum" >>/tmp/crontab
crontab /tmp/crontab

 

Note that you removed the & at the end of the line that runs emhttp then it will not load emhttp on background and will block your go script, no further commands would run until emhttp terminate...

 

And don't forget Joe L. advice for not using /sbin/poweroff ... you should probably use /usr/local/sbin/powerdown script instead.

Link to comment

Hmm yeah I know I did remove the & because I thought it was like the ^M :P

 

Gonna try it, if it works I don't know how to thank you :P

 

 

edit: Wooo it worked, amazing :) how one little symbol can cost you that much time :P

 

But... it wouldn't be me if I didn't have a new problem :(. Yesterday I noticed that my disk 2 was "invalid disk". I thought that was because I shut down the computer without stopping the array. So I thought a reconfiguration of the disks woud fix this. Since there was no data on my raid yet, I decided to reassign the disks. My 2 western digitals green 2TB became Hard disk 1 and 2( before hard disk 1 was a western digital green, but hard disk 2 was a samsung F4 green 2TB) and I set my 2 TB samsung F4 as parity disk. I let the system build the parity and format the other drives over night. When I woke up this morning the computer was at sleep (I've set it this way after an hour it goes to sleep). I woke the computer up and now the parity disk was invalid (note: it's the same disk that was previously used as disk 2). When the computer woke up from sleep I heard a strange noise, like a disk was trying to start, but it wasn't able to. (maybe it was the samsung?). So I was at the webinterface and the parity disk wasn't valid. A few moments later it became disabled. And the webinterface became inaccessible.

I did a hard reboot with the powerbutton.

Now the webinterface works again, but parity drive is red and shows :Not Installed. If I stop the array the samsung disk isn't there either :S. I can't see the SMART values since the disk isn't found :S. I did run HDD tune bad block test before mounting the drive into my unraid server and everything was fine. Is this drive (samsung f4 ) broken? Should I buy a new one?

 

Thanks in advance

 

I reboted the machine to get a system log:

tail -n 40 -f /var/log/syslog

Mar 4 09:19:39 Tower kernel: REISERFS (device md1): journal params: device md1, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30

Mar 4 09:19:39 Tower kernel: REISERFS (device md1): checking transaction log (md1)

Mar 4 09:19:39 Tower emhttp: shcmd (13): chmod 777 '/mnt/disk1'

Mar 4 09:19:39 Tower emhttp: shcmd (14): chown nobody:users '/mnt/disk1'

Mar 4 09:19:39 Tower emhttp: shcmd (15): mkdir /mnt/disk2

Mar 4 09:19:39 Tower emhttp: shcmd (16): set -o pipefail ; mount -t reiserfs -o user_xattr,acl,noatime,nodiratime /dev/md2 /mnt/disk2 |& logger

Mar 4 09:19:39 Tower kernel: REISERFS (device md1): Using r5 hash to sort names

Mar 4 09:19:39 Tower kernel: REISERFS (device md2): found reiserfs format "3.6" with standard journal

Mar 4 09:19:39 Tower kernel: REISERFS (device md2): using ordered data mode

Mar 4 09:19:39 Tower kernel: reiserfs: using flush barriers

Mar 4 09:19:39 Tower kernel: REISERFS (device md2): journal params: device md2, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30

Mar 4 09:19:39 Tower kernel: REISERFS (device md2): checking transaction log (md2)

Mar 4 09:19:39 Tower emhttp: shcmd (17): chmod 777 '/mnt/disk2'

Mar 4 09:19:39 Tower emhttp: shcmd (18): chown nobody:users '/mnt/disk2'

Mar 4 09:19:39 Tower kernel: REISERFS (device md2): Using r5 hash to sort names

Mar 4 09:19:39 Tower emhttp: shcmd (19): mkdir /mnt/user

Mar 4 09:19:39 Tower emhttp: shcmd (20): /usr/local/sbin/shfs /mnt/user -disks 16777214 -o noatime,big_writes,allow_other,use_ino

Mar 4 09:19:39 Tower emhttp: shcmd (21): /usr/local/sbin/emhttp_event disks_mounted

Mar 4 09:19:39 Tower emhttp_event: disks_mounted

Mar 4 09:19:40 Tower pms: Starting Plex...

Mar 4 09:19:40 Tower pms: Plex Media Server is not enabled

Mar 4 09:19:40 Tower s3_sleep: ==============================================

Mar 4 09:19:40 Tower s3_sleep: command-args=-C 1 -a -m 45 -e eth0 -D 0

Mar 4 09:19:40 Tower s3_sleep: action mode=sleep

Mar 4 09:19:40 Tower s3_sleep: check array=yes

Mar 4 09:19:40 Tower s3_sleep: exclude cache=-

Mar 4 09:19:40 Tower s3_sleep: check network=no

Mar 4 09:19:40 Tower s3_sleep: check device=

Mar 4 09:19:40 Tower s3_sleep: check SSH=no

Mar 4 09:19:40 Tower s3_sleep: check TTY=no

Mar 4 09:19:40 Tower s3_sleep: version=2.1.0

Mar 4 09:19:40 Tower s3_sleep: ----------------------------------------------

Mar 4 09:19:40 Tower s3_sleep: s3_sleep process ID 9854 started, To terminate it, type: s3_sleep -q

Mar 4 09:19:40 Tower emhttp: shcmd (22): :>/etc/samba/smb-shares.conf

Mar 4 09:19:40 Tower emhttp: Restart SMB...

Mar 4 09:19:40 Tower emhttp: shcmd (23): killall -HUP smbd

Mar 4 09:19:40 Tower emhttp: shcmd (24): ps axc | grep -q rpc.mountd

Mar 4 09:19:40 Tower emhttp: _shcmd: shcmd (24): exit status: 1

Mar 4 09:19:40 Tower emhttp: shcmd (25): /usr/local/sbin/emhttp_event svcs_restarted

Mar 4 09:19:40 Tower emhttp_event: svcs_restarted

 

Now the SAMSUNG_HD204UI is there again, but outside the array with a blue dot next to it :S

Link to comment

Would be probably better you start a new topic for that problem.

 

Btw, the syslog you posted is only last few lines on it... you need to get full syslog from Utils -> System Log also good posting hdd smart status (smartctl -a /dev/sdX  where X=a,b,c,...) if the drive is detected else you can't. Btw also make sure all you power/sata connections are ok.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.