MiniDLNA Cron Job

Status
Not open for further replies.

darkseed86

Dabbler
Joined
Aug 11, 2012
Messages
11
Hi,

I'm using Freenas 8.2.0 RELEASE and MiniDLNA -1.0.24_1-i386.

I'm trying to create a cron job that will either restart MiniDLNA, or rescan the media library (recreate the database) overnight, every night, so the library is never more than 24 hours old.

I have absolutely no experience in using FreeBSD commands, or cron jobs in Freenas, so to say the least, I'm struggling.

Can anyone give me a step-by-step guide to how to create a cron job that would either restart the MiniDLNA service, or initiate a rescan?

Thanks
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Check out my link to fix the MiniDLNA problem. It's not a CRON but I think it's the proper way to go. The trick is to have MiniDLNA installed and running before you continue.

Once you have that going you need to grab a copy of Putty to easily install the script and you are done. If you need help you can either PM me or post in the thread.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Since you are at 8.2.0 with the MiniDLNA plugin, do not incorporate the fix in posting #45 unless you can confirm those lines need to be changed. I have not looked at that version for this fix and it may not have been broken there anyway.
 

darkseed86

Dabbler
Joined
Aug 11, 2012
Messages
11
I followed the instruction in your tutorial post exactly, and now neither MiniDLNA, nor Tranmission will start in the GUI (as they both showed as OFF). FreeNAS gui just tells me that "some error occured".

What have I done wrong?

Sorry for the vague problem description, but I'm hoping you've experienced this???
 

darkseed86

Dabbler
Joined
Aug 11, 2012
Messages
11
Don't worry, I've sorted it, I just needed to stop and start the Plugins Service in the core services, now both plugins start fine.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Sorry, I would have responded earlier but my ISP was down. At first that said it was my modem but then they took a bigger look after I tossed them some technical mumbo jumbo and they said it was a piece of their equipment.

Glad you got it figured out and I hope it work well for you. As for little problems like what you experienced, I don't recall hearing of that one specifically but the plugins are picky and when you turn them off/on, you need to wait a small period of time because the hooks (I think I got that right) can get screwed up and then it's just a mess. At that point you might as well reboot, it can be faster to recover.
 

darkseed86

Dabbler
Joined
Aug 11, 2012
Messages
11
I did reboot, and the problem somehow persisted!? Don't quite know how that is possible, but it was fixed by going to Services>Core and restarting the Plugins Service entirely.

Thanks for the help on this, and don't worry about your response, I used to work for an ISP, I know how difficult it is to get them to do ANYTHING! lol

Thanks again.
 

kingcharles

Dabbler
Joined
Dec 2, 2012
Messages
17
If a cron job is good enough for me to initiate a rescan, would adding the command:

Code:
service minidlna restart


in the cron job GUI wizard be the right command?
Thanks
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Normally I'd say yes however there is a bug in the MiniDLNA plugin which you will need to kill the service, or you could fix the problem first and then it might work. The fix is in my thread MiniDLNA Automatic Scan Fix post #45. Please post if your CRON job works to restart MiniDLNA.
 

darkseed86

Dabbler
Joined
Aug 11, 2012
Messages
11
Yes, I'd be interested in the Cron Job working too if you could post back with your results/how to get it working.

I get an error with the command that you posted when I put it in a Cron Job:

SERVICE: not found

Could anyone tell me if this is part of the bug that has been discussed, or is it something that I'm doing that is wrong?

Thanks
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Yes, I'd be interested in the Cron Job working too if you could post back with your results/how to get it working.

I get an error with the command that you posted when I put it in a Cron Job:

SERVICE: not found

Could anyone tell me if this is part of the bug that has been discussed, or is it something that I'm doing that is wrong?

Thanks
You know that you have to create the CRON job within the jail, right? Can't use the GUI to do that. If you are in the jail then you should post exactly what you did.
 

darkseed86

Dabbler
Joined
Aug 11, 2012
Messages
11
Ahh, no, I was trying to create the cron job through the GUI. Did I mention that I'm a TOTAL noob with FreeNAS? lol

What command do I use to create the cron job within the jail? Sorry that you have to walk me through this step-by-step.
I assume I can use Putty and do it that way through command line?
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Time to learn like I did. There are a lot of CRON examples in these forums and on the internet. I will help you get into the jail, go to my MiniDLNA Fix-it thread (link in my tag line) and do step 3, that gets you into the jail. You need to get into the jail anyway to fix MiniDLNA so you can stop it in the first place.

Tinker around, might take you a few hours but you can get it. If you think you screwed something up in the jail, just uninstall the 'Plugins' and reinstall the 'Plugins' and 'MiniDLNA', quick and simple actually.
 

darkseed86

Dabbler
Joined
Aug 11, 2012
Messages
11
Thanks for all of your help joeschmuck, I've sorted it out now, with a lot of help from your posts!

I eventually upgraded to 8.3.0-RELEASE, then followed your instructions, then created a cron job with the following command:

jexec 1 service minidlna start

All seems to be working fine now. Thanks again.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
I'm not sure how that works by telling it to start, maybe you meant restart?

Either way, glad it's working for you.
 
Status
Not open for further replies.
Top