LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-18-2002, 08:36 AM   #1
pilot1
Member
 
Registered: Jun 2002
Location: USA
Distribution: Gentoo, Fedora Core
Posts: 408

Rep: Reputation: 30
Question Copying files at shut down?


Is there a way I can set up an alias so when I type something such as "neton" it copys 3 files to 3 different directorys? Also, is it possible to have it copy some files automatically whenever my computer is shut down or rebooted?
The files would be ifcfg-eth0, .vnetrc and possibly network
Thanks!
 
Old 12-18-2002, 09:14 AM   #2
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
For the neton you could write a simple script:

Code:
#!/bin/bash

cp file1 location1
cp file2 location2
Make the file executable:
chmod +x neton


To get it to run that at every shutdown you should add a symbolic link in the appropriate runlevel.

The link should be called something like K99copyfiles and be linked to the appropriate script file. Usually it links to scripts in the /etc/rc.d/init.d directory. There should be a template file there which you can copy and modify to call your script when it's called with the parameter stop.
 
Old 12-18-2002, 11:20 AM   #3
pilot1
Member
 
Registered: Jun 2002
Location: USA
Distribution: Gentoo, Fedora Core
Posts: 408

Original Poster
Rep: Reputation: 30
How would I add a symbolic link, and what would be the right runlevel for a shutdown/restart?
There wasn't a template file in /etc/rc.d/init.d..
 
Old 12-18-2002, 02:16 PM   #4
cipher_arg
Member
 
Registered: Oct 2002
Distribution: slackware 8.1
Posts: 62

Rep: Reputation: 15
the right run level for shutdown/reboot are 6 oe 0
check the aproppiate rc.6 script on /etc/rc.d/ folder

by looking at it you may realize how to make a symbolic link

You may also check out the rest of rc.*
 
Old 12-18-2002, 02:21 PM   #5
pilot1
Member
 
Registered: Jun 2002
Location: USA
Distribution: Gentoo, Fedora Core
Posts: 408

Original Poster
Rep: Reputation: 30
I did it, Thanks!
 
Old 12-18-2002, 03:23 PM   #6
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 255Reputation: 255Reputation: 255
Symbolic link command = ln -s [source] [destination]
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying files paddyjoy Linux - Newbie 10 10-25-2013 12:12 PM
copying files(s) in c climbingmerlin Programming 7 10-27-2005 03:00 PM
need help with copying files Earl Parker II Linux - General 8 09-12-2005 09:54 AM
Copying FIles Casper12 General 4 08-07-2005 05:30 PM
Copying Files... viperquest Linux - Software 3 03-07-2003 03:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:32 PM.

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