SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have two harddisks. During log off I want to automatically copy some files from the first disk to the second for backup purposes. I have a script for this. I want that the script is executed during log off. Has someone an idea how I can do this?
Assuming that you are talking about a user that logs out and that you use bash: Take a look at: ~/.bash_logout
Bash executes commands in this file after a user logs out.
Man bash (INVOCATION part) for details.
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,644
Rep:
Quote:
Originally Posted by synapse
as root
add the command to copy
to the rc.shutdown script
Are you sure it should not be named rc.local_shutdown? I never heard of your interesting tipp and did a quick grep on the rc.d scripts, but only rc.local_shutdown is shown ...
Only thing I can come up with: .bash_logout is only executed if the shell started is a login shell. But you state that you are always logged on as root. Is this an automatically started X session (init 5) or a command line session (init 3)?
The latter (init 3) should normally be a login shell and all should be working. Some distro's don't give root a login shell when starting a X session, which could explain why .bash_logout is not executed.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.