April 21, 201214 yr hello all, i've been frequently posting in the yamj thread but i'm not sure anyone's reading it!!! i've got yamj up and working, and i'd like to add a cron job to have yamj rescan daily at 2am the command is 'yamj-rescan' but i'm not sure what else i need to add, OR where to even put the script? any advice?
April 29, 201214 yr Have you tried to contact Damian, at the AVSForum.com. He might be able to help you. His username is dbone1026. He uses YAMJ + Eversion for his PCH's. He's helped me a lot regarding jukeboxes.
April 29, 201214 yr I'm not sure if there are any other commands you need, but to just add a cron job for yamj_rescan, it would look like this: #Run Yamj-rescan at 2 am every day 00 2 * * * /path/to/yamj_rescan You can insert this into your go file to add the cron on reboot, so you don't have to manually add it again: crontab -l > /tmp/file; echo '#Run Yamj-rescan at 2 am every day' >> /tmp/file; echo '00 2 * * * /boot/extra_my/yamj-rescan >/dev/null 2>&1' >>/tmp/file; crontab /tmp/file; rm /tmp/file To enter it without rebooting you can also copy/paste that line into telnet and it will add it. EDIT: Fixed a few errors discussed later in the post
April 29, 201214 yr Author thanks very much! i copied your command and pasted into my go file using notepad on my win7 machine, hope that's a good way to do it i altered a little bit as the actual name is yamj-rescan, so changed the underscore to a hyphen, i assume that's ok? as well, the yamj-rescan file is in a folder called extra at the root of the drive. so here's what's in my go file: crontab -l > /tmp/file; echo '#Run yamj-rescan at 2 am every day' >> /tmp/file; echo '* 2 * * * /extra/yamj-rescan 1> /dev/null' >>/tmp/file; crontab /tmp/file; rm /tmp/file look okay?
April 29, 201214 yr It it is in the root of the flash drive then the path should be /boot/extra/yamj-rescan. Using notepad should be fine, but if there are any problems you'll want to open it up in a linux editor, the easiest to use would probably be the internal editor with Midnight commander. To get to it you would open Midnight commander with "mc", then you would navigate to the go file, press F4 to edit and remove any wrong line endings you see, they will be "^M", then press F2 to save. I tested adding it to my go file with notepad and it appears to work fine so it shouldn't be a problem, just letting you know just in case. EDIT: In the future if your wanting to add a cron job that you are not worried about staying during reboot, you can add it by using "crontab -e", it will open the crontab up in the editor you set, the default being vi. It has a little bit of a learning curve, google is your friend there! But I would think most cron's you'd want to add you would want to stay after a reboot, the line I posted before is probably the easiest way to do it.
April 29, 201214 yr Author ok thanks... i have a folder in the root called boot and a folder called extra at the same level, therefore i didn't think to make path boot/extra/yamj-rescan...in a windows sense it seems like the path would be pointing in the wrong place so just to confirm, i have a folder called extra, in which yamj rescan is inside... even though i also have a folder called boot in the root ie same level as extra, i should still make path boot/extra/yamj-rescan correct? still learning
April 29, 201214 yr No, your right. In that case it would be /extra/yamj-rescan. Some stuff goes in /boot/extra, I wasn't sure if it would be the same with yamj-rescan or not, I was just making sure. Sorry for the confusion,
April 29, 201214 yr Author oops well i'll have to change back! i seem to be having a new problem... i added the command, then started a reboot... now i see that a parity check has started (can see through unmenu) but also only 2 of my 14 drives have mounted... so my array is not up. not sure if its related or just a separate problem... should i let the parity check finish? i wish there was some way to stop the parity check, then start my array, and then run the parity check later say tonight... i've got a couple of kids here who want to watch their shows (which are on the array!)
April 29, 201214 yr I would post a new issue about this, I'm not sure, personally I've never had to do a parity check outside of a monthly check that runs by itself.
April 29, 201214 yr oops well i'll have to change back! i seem to be having a new problem... i added the command, then started a reboot... now i see that a parity check has started (can see through unmenu) but also only 2 of my 14 drives have mounted... so my array is not up. not sure if its related or just a separate problem... should i let the parity check finish? i wish there was some way to stop the parity check, then start my array, and then run the parity check later say tonight... i've got a couple of kids here who want to watch their shows (which are on the array!) You can watch media while a parity sync/check is being performed. The "mounting" is because you had a hard shutdown. Be patient, they should mount once their journals in the file=systems are re-played to get the file-systems into sync. Joe L.
April 30, 201214 yr Author No, your right. In that case it would be /extra/yamj-rescan. Some stuff goes in /boot/extra, I wasn't sure if it would be the same with yamj-rescan or not, I was just making sure. Sorry for the confusion, oh my gosh i think you were right after all! so overnight, when 2am came, i started getting these emails: subject: cron for user root /extra/yamj-rescan 1> /dev/null body: /bin/sh: /extra/yamj-rescan: No such file or directory got one of these each minute from 2am to 3am! what i realized is that my extra folder is in the root of my SHARE, not necessarily the root of the drive, sorry i was mistaken. just looked through the interface and i think the flash share root is within boot....so i think i need to switch the location back to boot/extra/yamj-rescan BUT now how do i kill the existing cronjob? i expect it will run again tonight if i don't kill it? Please help me kill this one so that i can set one up with the proper path!!!
April 30, 201214 yr got one of these each minute from 2am to 3am! BUT now how do i kill the existing cronjob? i expect it will run again tonight if i don't kill it? Please help me kill this one so that i can set one up with the proper path!!! If you had #Run Yamj-rescan at 2 am every day * 2 * * * /path/to/yamj_rescan Then you were telling it to run every minute when the hour was 2. What you probably meant was #Run Yamj-rescan at 2 am every day 0 2 * * * /path/to/yamj_rescan Cron goes by: # Minute Hour Day of Month Month Day of Week Command # (0-59) (0-23) (1-31) (1-12 or Jan-Dec) (0-6 or Sun-Sat) You can also specify multiple values (comma delimited) for each, or a range (hyphen delimited) Now how to stop your cron job. From telnet prompt: crontab -e <brings up vi editor> <position cursor to beginning of the line you want to disable> <to delete the line, type dd> <to just comment it out, type i then # > then type <esc key> :wq to ensure it looks right, you can then do crontab -l from the cmd prompt
April 30, 201214 yr Author ok thanks graywolf... i had just fixed my path in the go file, but i will now adjust the timing as per your helpful explanation I will definitely mark the commands for future reference... to kill the job, i ended up rebooting, which then will have initiated the job in the go file, which has right path, but the incorrec timing... therefore i can use your commands to stop the new, incorrectly timed job! whew this is a bit of a work, but the learning is fun!
April 30, 201214 yr you might want to google "vi editor cheatsheet" will help when you want to edit crontab for how to get around in vi editor to list crontab = crontab -l to edit crontab = crontab -e
April 30, 201214 yr Yeah that was my fault, sorry! 0 2 * * * is right, Wouldn't have been so much work if I would have read what I posted! I thought that the extra folder would be in /boot/, but wasn't sure if the yamj installation put one at the root or not. Glad you got it figured out though.
May 1, 201214 yr Author Yeah that was my fault, sorry! 0 2 * * * is right, Wouldn't have been so much work if I would have read what I posted! I thought that the extra folder would be in /boot/, but wasn't sure if the yamj installation put one at the root or not. Glad you got it figured out though. no worries at all man, you got me 99% of the way there!
May 31, 201214 yr I added the above mentioned command crontab -l > /tmp/file; echo '#Run Yamj-rescan at 5 pm every day' >> /tmp/file; echo '* 17 * * * /boot/extra_my/yamj-rescan 1> /dev/null' >>/tmp/file; crontab /tmp/file; rm /tmp/file And now each time it runs (at 3 pm) I get several automatic emails regarding the process output (YAMJ). It seems to run again and again for the entire hour (until 6 pm) and each time it completes I get another email. 1. Why do I get an email? 2. Why does it run several times during the hour?
May 31, 201214 yr I added the above mentioned command crontab -l > /tmp/file; echo '#Run Yamj-rescan at 5 pm every day' >> /tmp/file; echo '* 17 * * * /boot/extra_my/yamj-rescan 1> /dev/null' >>/tmp/file; crontab /tmp/file; rm /tmp/file And now each time it runs (at 3 pm) I get several automatic emails regarding the process output (YAMJ). It seems to run again and again for the entire hour (until 6 pm) and each time it completes I get another email. 1. Why do I get an email? 2. Why does it run several times during the hour? For #2....because you told it to run every minute where Hour = 17 (5pm) Cron goes by: # Minute Hour Day of Month Month Day of Week Command # (0-59) (0-23) (1-31) (1-12 or Jan-Dec) (0-6 or Sun-Sat) * matches all values You have * 17 * * * so you say for every minute of hour =17 of every day of the month of every month of every day of the week, run the command If you want it every day at 5pm, you would want 00 17 * * * or for 5:15 pm 15 17 * * * etc etc ettc
May 31, 201214 yr and you get the e-mail because you did not redirect the output of your command somewhere. Any output of a cron command is mailed to the owner of that crontab. If you want no output, redirect both stdout and stderr somwhere (to a file, or, if not needed, to /dev/null)
May 31, 201214 yr Thank you. corrected it to: crontab -l > /tmp/file; echo '#Run Yamj-rescan at 5 pm every day' >> /tmp/file; echo '00 17 * * * /boot/extra_my/yamj-rescan >/dev/null 2>&1' >>/tmp/file; crontab /tmp/file; rm /tmp/file
Archived
This topic is now archived and is closed to further replies.