run a script at login (for display & mount issues)

If you are new to Linux or new to Sabayon Linux and just not sure where to post, here ya go. Post without fear of being told to RTFM :-)

Moderator: Moderators

Re: run a script at login (for display & mount issues)

Postby Marius » Sun Dec 06, 2009 20:33

Fitzcarraldo wrote:My point regarding .input was that, if ninodog did as you suggested then it would not have worked. Mind you, neither would my first suggestion of executing the xrandr command via /etc/conf.d/local. I doubt he would be interested in changing shells, and there is no need to do so in order to achieve his goal. Haven't used the C shell myself since I used Unix professionally in the early 1990s, when I also used the Korn shell. Never tried the TENEX C shell, though.


I suppose by .input you mean .login ?

What you call the TENEX C shell (I had to google this term) has been one of the original UNIX shells developed soon after the first shell was created by Stephen Bourne as can be gleaned from the following chronological table:

Code: Select all
1970 - UNIX Operating System Developed by AT&T Bell Labs

1971 - FTP Protocol Created by Abhay Bhushan
1972 - C Language Developed by Dennis Ritchie
1976 - vi Text Editor Developed by Bill Joy
1977 - Apple II Designed by Steve Jobs and Steve Wozniak
1977 - The Bourne Shell Developed by Stephen Bourne
1978 - The C Shell Developed by Bill Joy
1978 - Bash (Bourne-Again Shell) Developed by Brian Fox
[b]1979 - The Tcsh (TENEX C Shell) Developed by Ken Greer[/b]
1983 - "Sendmail" Mail Transfer Agent Developed by Eric Allman
1984 - Macintosh Developed by Apple Inc.
1984 - X Window System Developed a MIT Team
1991 - WWW (World Wide Web) Developed by Tim Berners-Lee
1991 - Gopher Protocol Created by a University of Minnesota Team
1995 - Java Language Developed by Sun Microsystems


at this computer history site

http://www.herongyang.com/Computer-History/index.html ,

and it has been in every UNIX/Linux for ages. A newbie to Linux may at least profit by knowing that using tcsh is an alternative to using bash, as using vi(m) is an alternative to using emacs. Neither one is inferior. All of them are mature. And each has some advantages over the alternative.

By the way, I initialize syndaemon in my .login file. More people may need to know about syndaemon whose main purpose is to disactivate touchpad for a few seconds after you use keyboard. Simply invaluable when typing on a laptop in a text editor or web browser.

Activating syndaemon before logging into a desktop would not work, and I regularly use more than one desktop so I don't want this demon initialization to be desktop specific.
Marius
Simple Hen
 
Posts: 82
Joined: Thu Nov 01, 2007 5:48
Location: Berkeley, California

Re: run a script at login (for display & mount issues)

Postby ninodog » Wed Dec 09, 2009 21:35

Wow, this has turned into a major p.i.t.a.

First, thank you both for your help with me and for the discussion between yourselves which also contained good clues on what to try next. Nothing seems to work and it's very frustrating to test, make a minor revision and test again because it requires rebooting to see if the just made revision works.

A review. I want to

1) mount networks shares automatically during either boot or login. Preferably during boot. The normal way of doing this through /etc/fstab would not work.

2) log in with the same screen resolutions I used in my previous session.

Regarding #2, I have found from other discussions that this is a bug in kde4. Fitzcarraldo referred my to "[SOLVED] KDE4.1 Display Settings not saved in Kubuntu" http://forum.kde.org/viewtopic.php?f=66&t=20494 and, after trying the recommended change to ~/.kde4/share/config/krandrrc without success, I have to agree with the person who said that the discussion should not be marked [SOLVED] because the "solution" ultimately suggested was to issue the xrandr command, something we already knew.

Regarding #1, I have no idea what's up. First /etc/fstab does not automatically load the shares. I have no idea why it doesn't work. Should it be made executable? If I do a listing of it, I get this permission: -rw-r--r--. Is that right?
I've also tried putting the mount commands in /etc/conf.d/local, which seemed like a good suggestion and it too did not work. I used exactly the same commands I would have issued in the bash window, so I don't know what's going on. I tried various options with the commands, tried putting sudo in the front of each line and tried making the file executable with chmod +x /etc/conf.d/local. All to no avail. Below is my final version. Do you see any mistakes?:
Code: Select all
# Here is where you can put anything you need to start
# that there is not an init script for.

local_start() {
        # This is a good place to load any misc programs
        # on startup (use &>/dev/null to hide output)

# JPH added lines to mount 3 network shares 091209
mount 192.168.1.101:/home/video /home/video
mount 192.168.1.101:/home/music /home/music
mount 192.168.1.101:/home/arkh /home/arkh

        # We should always return 0
        return 0
}

local_stop() {
        # This is a good place to unload any misc.
        # programs you started above.

        # We should always return 0
        return 0
}

Note that I am aware that before I said the shares were 192.168.1.103 and now they're 192.168.1.101 - that is correct. The power went out and when the machines started back up they changed their number. Issuing the mount command as written above on the command line will mount the shares.

Finally, I moved my script /etc/init.d/jph091203-startup to my home directory and tried making a symbolic link to it in ~/.kde4/Autostart but that would open the file in kwriter when I logged in, rather than execute the commands. That, of course, is user error as I somehow didn't issue the command right, but I don't care anymore. I decided that I'm working too hard to make a kludge run and that it isn't worth any more time.

By the way, the problem with /etc/fstab might be a Sabayon problem because I have the same issue with Sabayon 4. I bet it comes down to user groups or file permissions which aren't automatically granted when the system's installed. I don't have the same issues with k/ubuntu, but have other problems there. :)

At this time, I'm going to stop trying to fix this. I'll just run the xrandr command and the mount commands when I log in. That's easy enough. Thank you, Fitzcarraldo and Marius, for your suggestions. I learned a fair amount by following the advice offered so it hasn't been a waste of time.
ninodog
Baby Hen
 
Posts: 13
Joined: Tue Apr 14, 2009 3:32

Re: run a script at login (for display & mount issues)

Postby Fitzcarraldo » Fri Dec 11, 2009 2:07

ninodog wrote:Finally, I moved my script /etc/init.d/jph091203-startup to my home directory and tried making a symbolic link to it in ~/.kde4/Autostart but that would open the file in kwriter when I logged in, rather than execute the commands. That, of course, is user error as I somehow didn't issue the command right, but I don't care anymore. I decided that I'm working too hard to make a kludge run and that it isn't worth any more time.

I'll leave you in peace if you've had enough, but I just want to point out that the way to do it is as I described in a previous post, viz. enter "sh /home/ninodog/jph091203-startup" (without the quotes) in the Command box of the Desktop Config file in the /home/ninodog/.kde4/Autostart/ directory. For example, here's the Desktop Command file Make_a_copy_of_important_files.desktop that I use to kick off a shell script (file name is copy_important_files_to_my_home_directory) that is in my home directory:

Code: Select all
[Desktop Entry]
Comment[en_GB]=Copy a few important files to a directory on my home partition
Comment=Copy a few important files to a directory on my home partition
Exec=sh /home/fitzcarraldo/copy_important_files_to_my_home_directory
GenericName[en_GB]=Make a copy of a few important files
GenericName=Make a copy of a few important files
Icon=/home/fitzcarraldo/Pictures/Icons/floppy_disk.png
MimeType=
Name[en_GB]=Make_a_copy_of_important_files
Name=Make_a_copy_of_important_files
Path=
StartupNotify=true
Terminal=true
TerminalOptions=\s--noclose
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=none
X-KDE-SubstituteUID=false
X-KDE-Username=


I should point out that the above file was created for me when I used the GUI procedure I described in my earlier post:

Fitzcarraldo wrote:He can use Dolphin or Konqueror to navigate to the ~/.kde4/Autostart directory, right-click on the window and select Create New > Link to Application... from the pop-up menu. Then he can click on the Application tab and enter the xrandr command in the Command box, fill in the other boxes as desired, and click on the icon on the General tab to select a nice icon of his choice. Alternatively, if ninodog wants to kick off his shell script then he could instead put sh /home/ninodog/jph091203-startup in the Command box.
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7981
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Previous

Return to Beginners|Newbies Area

Who is online

Users browsing this forum: No registered users and 3 guests

cron