- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Cron Jobs after NVX System Reset
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
When I got my NVX back in 2009 I started playing around with cron jobs to do a few things and they worked fine.
I just recently did a system reset and I saved all the text associated with my cron jobs etc. I have reinstalled SSH Root add on and get in fine with Putty but when I type in crontab -e I just get....
-bash: $: command not found
I dont normally have anything to do with scripting etc and I know all those years back a lot of guys on the netgear forum helped me to get it all to work.
I have tried searching for all my posts from 2009 etc and could only find from 2011 onwards.
Any help would be much appreciated and I will be saving all the instructions this time and not rely on the forum to keep all the info this time lol 🙂
Thank you
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you do the apt-get update again (after you modified sources.list)?
All Replies
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
@freewun13 wrote:
-bash: $: command not found
I get this:
PRO:~# crontab -e
no crontab for root - using an empty one
/bin/sh: /usr/bin/editor: No such file or directory
crontab: "/usr/bin/editor" exited with status 127
You do need to log in as root. crontab should be in /usr/bin
PRO:~# which crontab
/usr/bin/crontab
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
LIke I said...this was a long time ago so I have even less of an idea now! From Putty....
Using username "root".
root@192.168.1.6's password:
Last login: Fri Oct 19 21:36:16 2018 from 192.168.1.10
Last login: Fri Oct 19 21:38:41 2018 from 192.168.1.10 on pts/0
Linux NAS 2.6.37.6.RNx86_32.1.4 #1 Thu May 28 16:18:23 PDT 2015 i686 GNU/Linux
NAS:~# cd /usr/bin/
NAS:/usr/bin# ~# which crontab
-bash: ~#: command not found
NAS:/usr/bin# crontab -e
no crontab for root - using an empty one
/bin/sh: /usr/bin/editor: No such file or directory
crontab: "/usr/bin/editor" exited with status 127
NAS:/usr/bin#
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
Here is one of the tasks I had running. Pinging various IP's around the house and then shutting down the NAS. So I had a file called pingmedia.sh and the cron job running the ping on a schedule. I just cant figure out how to create the ping media file or create the cron job....
nano ~/pingmedia.sh
#!/bin/bash
# Ping Main Bed TV
ping -c 2 192.168.1.50 > /dev/null
if [ $? != 0 ]
then
# Ping Desktop
ping -c 2 192.168.1.10 > /dev/null
if [ $? != 0 ]
then
# Ping VPN
ping -c 2 192.168.1.200 > /dev/null
if [ $? != 0 ]
then
# Ping Media Server 1 Lounge
ping -c 2 192.168.1.51 > /dev/null
if [ $? != 0 ]
then
# Ping Yamaha Amplifier Lounge
ping -c 2 192.168.1.53 > /dev/null
if [ $? != 0 ]
then
# Ping Media Server 1 Lounge
ping -c 2 192.168.1.51 > /dev/null
if [ $? != 0 ]
then
# Ping Desktop
ping -c 2 192.168.1.10 > /dev/null
if [ $? != 0 ]
then
# Ping Main Bed TV
ping -c 2 192.168.1.50 > /dev/null
if [ $? != 0 ]
then
# Ping VPN
ping -c 2 192.168.1.200 > /dev/null
if [ $? != 0 ]
then
# command to shutdown:
/frontview/bin/autopoweroff & /dev/null
fi
fi
fi
fi
fi
fi
fi
fi
fi
crontab -e
# m h dom mon dow command
00-59/05 22 * * * ~/pingmedia.sh
00-59/05 23 * * * ~/pingmedia.sh
00-59/05 00 * * * ~/pingmedia.sh
00-59/05 01 * * * ~/pingmedia.sh
also trying to do the shutdown with...... ~# /frontview/bin/autopoweroff & /dev/null
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
@freewun13 wrote:
NAS:~# cd /usr/bin/
NAS:/usr/bin# ~# which crontab
-bash: ~#: command not found
Something is wrong here. If you have a spare disk, try doing a factory install with only that disk in place. Then see if you get the same result.
What firmware are you running?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
The last one published.... RAIDiator-x86-4.2.31
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
OK...changed disk and changed position of the single disk.....
NAS:~# crontab -e
no crontab for root - using an empty one
/bin/sh: /usr/bin/editor: No such file or directory
crontab: "/usr/bin/editor" exited with status 127
NAS:~# which crontab
/usr/bin/crontab
Looks the same to me.
Still dont know how to create pingmedia.sh file!?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
It appears nano isnt installed and wont install....
NAS:~# sudo apt-get update
Hit http://www.readynas.com 4.2.31/ Release.gpg
Ign http://www.readynas.com 4.2.31/ Translation-en_US
Hit http://www.readynas.com 4.2.31/ Release
Ign http://www.readynas.com 4.2.31/ Packages/DiffIndex
Hit http://www.readynas.com 4.2.31/ Packages
Reading package lists... Done
NAS:~# sudo apt-get install nano
Reading package lists... Done
Building dependency tree... Done
E: Couldn't find package nano
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
Why are you using sudo? If you are using root (as you should be) it isn't needed.
On nano, look here: https://community.netgear.com/t5/Legacy-NETGEAR-and-Partners-Add/Can-t-install-nano/m-p/931919#M1267...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
I used it because I found it on a web site somewhere and I dont have a clue why this isnt working. I have previously found the post of the link you sent and uncommenting makes no sense to me so like all the other pages I have looked at I gave it a miss because I didnt know what I was doing.
Never used Vi so no clue again. I am a windows user.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
@freewun13 wrote:
I used it because I found it on a web site somewhere
Sudo gives you temporary root credentials, which isn't needed in this case.
@freewun13 wrote:
I have previously found the post of the link you sent and uncommenting makes no sense to me so like all the other pages I have looked at I gave it a miss because I didnt know what I was doing.
Well, you need to edit that file in order to get the needed libraries for nano.
You can potentially copy it to the data volume, and edit it on the PC with notepad++. This is a freeware text editor that supports linux-formatted files (normal notepad and wordpad don't). You will need to make sure that when you save the file you set the option for linux formatting, as the program will assume you want windows formatting (because you are doing the editing in windows).
Then copy that modified file back to where it needs to be. Keep a copy of the original, in case something goes wrong.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
Well, you need to edit that file in order to get the needed libraries for nano.
You can potentially copy it to the data volume, and edit it on the PC with notepad++. This is a freeware text editor that supports linux-formatted files (normal notepad and wordpad don't). You will need to make sure that when you save the file you set the option for linux formatting, as the program will assume you want windows formatting (because you are doing the editing in windows).
I have Notepad++ and always use that. So which file am I copying, sources.list?? Not sure how to copy and where to in Linux.
Thank you for your patience 🙂
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
Managed to copy the sources.list file to windows, uncommented the last line using Notepad++ and then copied it back to /etc/apt/.
Ran apt-get install nano
and got this again....
Reading package lists... Done
Building dependency tree... Done
E: Couldn't find package nano
Did I miss anything?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
Did you go to edit in the task bar, and set eol conversion to UNIX/OSX format before you saved the file in notepad++?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
Hmmm...that would be a big...BUGGER NO!
Didnt save a copy of the file either so I guess a default reset or should I reload f/w by going back a version?
Just opened the file and the eol conversion to UNIX/OSX format is greyed out...wont let me select. Only Windows and MAC can be selected.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
or maybe do a OS reinstall from boot menu?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
You could try creating a new file in notepad++, since this is short.
You could also use
# cd /etc/apt
# mv sources.list sources.temp
# tr -d '\r' < sources.temp > sources.list
Be careful to use the correct slash on the '\r'
You should always keep a copy of the original files when you make these mods.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
Created a new file as suggested and made it Unix format in the EOL conversion before saving. Copied it to /etc/apt/sources.list successfully and then....
NAS:/# apt-get install nano
Reading package lists... Done
Building dependency tree... Done
E: Couldn't find package nano
I dont seem to be progressing anywhere with this!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you do the apt-get update again (after you modified sources.list)?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
Nano is all good now....will have another look tomorrow at cron etc and let you know how I go 🙂
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Cron Jobs after NVX System Reset
All working 🙂
Thnx heaps for your help Stephen
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content