LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-04-2017, 01:38 PM   #1
sainoh
LQ Newbie
 
Registered: Mar 2017
Posts: 4

Rep: Reputation: Disabled
hostname in crontab


Hi,
I am a total Linux Newbie, so this might be (too) easy for you
I am running a Synology NAS and have to replace an IP address in crontab by the dyndns hostname

crontab looks like:
20 4,16 * * * root /bin/dl-lesenx -i 192.178.55.22:40000 --res --dir /volume1/public/transfer/

how can I replace IP address:Port by hostname:Port ?

txs

Charlie

Last edited by sainoh; 03-04-2017 at 01:40 PM.
 
Old 03-04-2017, 02:27 PM   #2
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 2,037

Rep: Reputation: 273Reputation: 273Reputation: 273
Code:
crontab -e
is how you edit a crontab file. Note that it runs crontab's default editor, usually ed. If you don't want to deal with ed you can change the default editor with an environment variable. Run
Code:
man crontab
for more information.
 
Old 03-04-2017, 02:30 PM   #3
sainoh
LQ Newbie
 
Registered: Mar 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
I wasn't clear enough, I am afraid

I know how to edit, but can I replace

20 4,16 * * * root /bin/dl-lesenx -i 192.178.55.22:40000 --res --dir /volume1/public/transfer/

by

20 4,16 * * * root /bin/dl-lesenx -i bigboy.selfip.net:40000 --res --dir /volume1/public/transfer/
 
Old 03-04-2017, 05:48 PM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
edit /etc/hosts,
Code:
192.178.55.22 bigboy.selfip bigboy
then
Code:
ping bigboy.selfip
returns 192.178.55.22
Then you can utilize "poor man's dns".
Code:
20 4,16 * * * root /bin/dl-lesenx -i bigboy.selfip.net:40000 --res --dir /volume1/public/transfer/

Last edited by Habitual; 03-04-2017 at 05:50 PM.
 
Old 03-04-2017, 09:24 PM   #5
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 2,037

Rep: Reputation: 273Reputation: 273Reputation: 273
Sorry, Mr sainoh: you asked in newbies and told us how simple to expect it to be... Back in the good old days before DHCP I had to keep /etc/hosts so people didn't have to remember IP addresses. Even after I still did it for a while; I forget why. Mr Habitual has the correct answer; there's still fun to be had assigning addresses in /etc/hosts. A forgotten old comedy troupe has some odd videos only available at an IP address (at least that's all Google returned); I added a domain for them in /etc/hosts so I didn't have to remember it.
 
Old 03-05-2017, 08:42 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,201

Rep: Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089Reputation: 6089
The question its still vague. Is 192.178.55.22 a public address or typo?

If the OP is using a dynamic IP service for their public IP address then adding a line to the /etc/hosts file will fail when it changes.

If by dyndns your only referring to your local router DHCP then you should be able to configure any device with a static IP or use the routers address resveration feature which most have these days.

If your asking can you change from an IP address to hostname from a program perspective then it depends on the meaning of the -i option. I am unfamiliar with dl-lesenx.

If your asking can you change from a crontab perspective then yes. Most distributions are configured to use vim and you can find lots of guides on using its commands.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HOSTNAME = hostname -> HOSTNAME: command not found ? thomas2004ch Linux - Software 2 08-26-2013 08:25 PM
getting errors related to hostname -- security problem? ok to change hostname? sneakyimp Linux - Server 2 11-18-2012 05:25 PM
clients CAN resolve hostname of server w/nslookup, but CANNOT access by hostname WTF? psycroptic Linux - Networking 9 11-10-2012 11:24 AM
Changed hostname during install, now CUPS has wrong hostname on web interface slinx Linux - Software 1 08-07-2009 08:01 PM
after hostname change, syslogd still output previous hostname to messages file tiger2000 Linux - General 3 07-22-2009 09:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration