LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 07-20-2016, 09:56 AM   #1
tpolim008
LQ Newbie
 
Registered: Jul 2016
Posts: 4

Rep: Reputation: Disabled
Question Ubuntu 14.04 LTS Server


Hi All,
I am new to the linux world and started my journey off with Ubuntu seeing and reading that it is the easiest for starters. I started writing scripts for my job which I am a network engineer I deal with Juniper and cisco routers. I started off with Bash then expect and now using rancid automation. I currently wrote a script to update router configs on roughly 200 boxes. I am using the following lines/script in rancid as the rancid user to do this. I am looking to do two things where I cant figure it out as Im very new and only been doing htis for about 3 months now.

Here is the commands/script I run and looking to do the following with it.
for uer in `cat /home/tpolim001/device-list.txt`; do /var/lib/rancid/bin/clogin -x /home/tpolim001/acl.txt $uer; done

I would like to be able to do a nohup with it I cant figure out the exact syntax to do this and also to log the output in my home directory /home/tpolim001/script_logs can someone ehlp guide me thru this or provide me pointers on how I can make this better?
 
Old 07-20-2016, 10:29 AM   #2
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,362

Rep: Reputation: 135Reputation: 135
Welcome to LQ tpolim.

Put your commands in script.sh and if your script works fine , give execute permission to the script and run it like this:


Code:
 
chmod +x script.sh
nohup bash script.sh > /home/tpolim001/script_logs/logoutput.txt 2>&1
It will run your script in nohup mode as well redirect your logs to a logfile in your home directory.

Last edited by divyashree; 07-20-2016 at 10:32 AM.
 
Old 07-20-2016, 11:22 AM   #3
tpolim008
LQ Newbie
 
Registered: Jul 2016
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thank for the fast response that seems to have done the trick. Opposed do doing this one at a time, would adding a spawn to the bash file assist on allowing several connections to occur at once to speed up the script process? IS there also anything that I can do if I decide to spawn this to hit the first device then make it ask for user input to ensure that everything worked out how I would have liked it prior to hitting the rest? i would hate to spawn it and then kill our back office network.

Quote:
Originally Posted by divyashree View Post
Welcome to LQ tpolim.

Put your commands in script.sh and if your script works fine , give execute permission to the script and run it like this:


Code:
 
chmod +x script.sh
nohup bash script.sh > /home/tpolim001/script_logs/logoutput.txt 2>&1
It will run your script in nohup mode as well redirect your logs to a logfile in your home directory.
 
  


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
LXer: Zentyal Server 4.0 : Linux Business Server Based on Ubuntu Server 14.04 LTS LXer Syndicated Linux News 0 11-19-2014 02:41 PM
LXer: Ubuntu 12.04.5 LTS (Precise Pangolin) Released with Linux Kernel from Ubuntu 14.04 LTS LXer Syndicated Linux News 0 08-08-2014 09:00 AM
LXer: How to Upgrade Ubuntu Server 12.04 to Ubuntu Server 14.04 LTS LXer Syndicated Linux News 0 06-17-2014 05:20 AM
LXer: How to Install and Configure Proxy Server with Squid3 on Ubuntu Server 12.04 LTS LXer Syndicated Linux News 0 05-31-2012 11:40 AM
LXer: The Perfect Server - Ubuntu Hardy Heron (Ubuntu 8.04 LTS Server) LXer Syndicated Linux News 0 04-27-2008 07:50 AM


All times are GMT -5. The time now is 08:34 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration