Ubuntu :: Edit Startup Scripts To Add An Arbitrary Command?
Oct 11, 2010
sometimes you want to run a command every time computer boots up. In DOS there is "autoexec.bat" in windows - "Startup" menu and I'm sure that there is a similar thing exists for Ubuntu, but that's not what I'm after.These things above will run a command when a user logs on. I want to run a command when a pc boots up. This is not straightforward in Windows, but since I'm a windows guy I can do this. I can install a command as a service with srvany utility that will make sure it will execute on boot up.Now I want to do a similar thing in ubuntu. how do I edit startup scripts in ubuntu to add an arbitrary command? I need to run the command in the context of a particular user, so I normally do it like this:
Code:
sudo -u myServiceUser -i myService
But I want as little downtime as possible and sometimes it takes sometime to find out that there has been a reboot, get to a computer and run the command manually. If I could run this automatically on bootup I wouldn't have this problem.
I'd like you to know that I'm completely new to ubuntu. Just install it a couple of days ago. I have a bit problem with startup here, everytime I change anything in System > Preferences > Startup Applications it just keep coming back to default. I unchecked Penmount Utility, and it's checked again after next boot. Same thing happen when I add Guake Terminal. When I reboot, it's not there anymore. So basically, it seems that I can't configure my startup programs.
I have (normal) Ubuntu 11.04 installed and I used the Ubuntu Software Center to install LXDE. I'm stuck on 2 problems though, and I'm not sure how to fix them.1. How do I change key bindings in LXDE? Specifically, I want to use Super+up/down/left/right change between workspaces, not the defaultCtrl+Alt+up/down/left/right. I have a script that I have set to auto-run on startup in my standard Unity session; I created a script and added it to the startup programs list there. However, I need to remove that script from LXDE ONLY, so that in the Unity session it will continue to run, and in the LXDE session it will NOT run
i somehow managed to mess up my install of 10.10 I used the alternate AMD 64 install so now when I login it is only a text prompt. This leads me to believe that I am running in Ubuntu Server. I read this article:
[URL] but my network is not setup!! So I tried to do this: [URL] but when I get to:
Code:
sudo vi /etc/network/interfaces
I dont realy know how to edit the file.I basicaly see
Code:
# The loopback network interface auto lo iface lo inet loopback
After a fresh boot of a Live CD, how do I use the gconftool command to edit: Code: /root/.gconf/apps/gnome-terminal/profiles/Default/%gconf.xml ??
I tried: Code: mint@mint ~ $ sudo su mint mint # gconftool --load /media/scripts/gconf/gnome-terminal/custom.xml mint mint # gnome-terminal
No changes were made after I opened a new gnome-terminal. It works fine if I'm not in superuser mode and makes the changes to Code: /home/mint/.gconf/apps/gnome-terminal/profiles/Default/%gconf.xml just fine. What am I not getting here?
I have gone over the thread "Learn The DD Command Revised" (It was Fantastic) in the search for a solution to my query.
I have seen posted elsewhere that this code is supposed to be able to change the UUID number of NTFS partitions (useful when multi-booting with Grub2 and cloning partitions). Here is the code:
Code: sudo dd if=/dev/urandom bs=80 count=1 | xxd -l 80 -c 8 | tail -1 | xxd -r - /dev/sda1 This is assuming that I want to change the UUID on the 1st partition on the 1st hard drive >>>sda1<<< If I was trying to modify the 2nd partition on the 1st hard drive it would be >>>sda2<<<
[Code].....
NOTE: I was doing this while booting from Ubuntu's Live CD version 10.04.1 LTS (In case that is a factor)
I am here with a troublesome question about my new Ubuntu set up. Well as I've found out that you have to use the Sudo command to edit anything out side the home directory. Well I am using L.A.M.P. Server on my computer so I can host a small forums. Well for example like lets say I install Word press Blog onto my lamp server and I want to install a theme well when i go to install a theme i can not because WPB can't install the theme because of the security stuff on Ubuntu!
Well I want to know if there is some kind of command or program i can use that will get rid of all the security stuff were i can edit stuff nice and easy. Like something that can give me FULL control over the OS so no more commands because I am going to be running a Vbulliten forums which needs themes and plug ins, well i want be able to install them because this OS will not let me!
I just need to edit the "rm " command such that it should move all the files / dir to a particular folder instead of deleting. How to edit the source code for rm, such that it should preserve all the deleted files / dir.
Is it possible to forward a connection to a port to a completely unrelated external address? For example, I want to redirect ssh traffic to a.b.c.d to w.x.y.z. If w.x.y.z were an internal address and the machine was the router, this would just be plain old NAT port forwarding. But what if w.x.y.z is not an internal address? The reason I want to do this is I want to reassign a domain name example.com from ip address A to B, while allowing users to still ssh into A by using the [URL] domain name. Is this unreasonable? (I am guessing it is unreasonable, since the A wouldn't have it's gateway set to B, as is the case if A were in B's NAT'd internal network.)
i try do modify BASHRC and ENVIRONMENT files on directory ETCthen all the command don't work, such as:SUDO, GEDIT, NAUTILUS, NANO and some others!now i want to edit the 2 files and delete the insert lines
I have the following code in bash script: Code: #!/bin/bash COUNT=1 # bash until loop until [$COUNT -gt 2]; do pq A$COUNT [Pemptus].pq & let COUNT=COUNT+1 done
I did this because I'm that much of a Progress Quest geek that I wanted to have a huge group on the online server, so I decided to make a script that would open all the files for me rather than having me do it manually. I created some characters with the boring name of A1, A2, etc. When I ran the above script, it went into a continuous loop and I had to halt it, then run sudo killall pq.exe to eliminate the 500 or so Progress Quest windows that popped open. Anyway, what is wrong with my script that I can't seem to get it to stop loading files at an arbitrary number? I want to get this part finished before I make any more boring named characters.
A brief description of my network:It is a small home network consisting of an Ubuntu 10.04LTS server edition, an Iomega ix2 NAS, a WinXP pro server and several family laptops.This is all routed through a Netgear WNDR3300 home router. All are assigned IP's via DHCP and all but the laptops are static (via DHCP though). The WAN address/DNS is assigned via DHCP from my ISP.The problem:When one of the machines is offline, Ubuntu does not resolve the netbios name correctly. No surprise here. But what is happening is that it is finding some arbitrary machine on another network. Below is what a ping to an offline host reveals:
I experience unpredictable crashes, When typing an email I am unable to recapture that which I wrote. without warning the "back" button disappears. it is sometimes there and sometimes not.
When I try and run gedit command through terminal to edit files it won't open them
Quote: (gedit:4113): EggSMClient-WARNING **: Failed to connect to the session manager: None of the authentication protocols specified are supported g_dbus_connection_real_closed: Remote peer vanished with error: Underlying GIOStream returned 0 bytes on an async read (g-io-error-quark, 0). Exiting.
my Iceweasel always crashes when I attempt to open any file (usually pdfs, but I tried with .odt too). I only found this thread [URL] .... and commented out as told by MekkaGodzilla in /etc/gnome-vfs-2.0/modules/default-modules.conf Coment out this line : file:file
I try to fix bugs on my web server. The remote web server allows redirects to arbitrary domains. Description : The remote web server is configured to redirect users using a HTTP 302, 303 or 307 response. However, the server can redirect to a domain that includes components included in the original request. A remote attacker could exploit this by crafting a URL which appears to resolve to the remote server, but redirects to a malicious location.
i have a file, 2fsrl, that i want to run at startup. If i type /home/kent/2fsrl in the terminal it works. Although it won't work if i put the command in Startup Applications.
In my file is this: synclient VertTwoFingerScroll=1 synclient HorizTwoFingerScroll=1 synclient EmulateTwoFingerMinW=5 synclient EmulateTwoFingerMinZ=48
i need to run this command at the boot of computer
Code: hdparm -B 255 /dev/sda
i saved this command in the file /etc/rc.local but i don't know why...it doesnt work, so i have to run it after boot from terminal..here there is the content of the file:
I want to generate a temporary random list from a directory of files and then determine the size of an arbitrary block of files from this list (say 1-25 or 26-50) and add their names to a file along with some other info for each name. I can generate a random list with file sizes like this: ls -l | sort -R | cut -d " " -f 6 but i'm not sure how to add up the sizes of just a certain block of these files and at the same time save the file names.
I know how to make things run at startup, and obviously know how to run a command in terminal (type and enter... duhhhh). However I would like to be able to run vnstat in terminal when my computer logs in, this is very handy for seeing how much I have downloaded. I have a terminal embedded on the desktop and would very much like to run vnstat in it for me when it starts, I know I could just type in vnstat when I've logged on, but where is the fun in that? Just having it already there for me would be far better.
The command for starting my desktop terminal is as follows: Code: gnome-terminal --window-with-profile=trans --geometry 90x40+280+30
Relative newbie here - seeking advice on having a command run on start-up. Specifically, I want to have a chgrp and chown execute on a specific directory, subdirectory and associated files. I'm not looking for advice on how to do it (I'd like to muddle through it on my own - I learn better). And, I'm not looking for alternatives. Background - I think this is the easiest way for me to have two users on the same PC upload photos that each user can have full access to, and do things like back-up etc.
I wish to enable battery tab in Acer 751, Lucid. The command I type in terminal every time I start the netbook is: Quote: cat /proc/acpi/battery/BAT1/info How do I make it run automatically on start up?
I know this has been asked a 1000 times, but none of the solutions I've read so far work.I need to run the following terminal command every time Ubuntu (10.04 64bit) starts:Code:xset m 9 1This boosts mouse speed to maximum. I don't know why, but it is the only thing that works. All built-in mouse settings are at maximum, yet my mouse crawls across the screen when Ubu starts. So far, I have tried:Creating a startup script called "/etc/init.d/autorun.sh" containing code...
I've searched everywhere, but they all talk about BOOTING into the terminal instead of ubuntu. But here all I want is for ubuntu to automatically run a certain command when I boot into ubuntu.This is related to the screen brightness change problem that's still much of an unsolved mystery for ubuntu and I have mostly solved this 'm able to change the brightness with sudo setpci -s 00:02.0 F4.B=xx, xx being from 00 to FF, but it doesnt seem to stay when I log out and log back in. Is there any possible way to put a terminal command in the startup applications or something or a possible solution to the brightness problem that I havent discovered yet?
How would i make ubuntu just execute this Code: deluged -p 10002 -c ~/delugebig/ at startup? Just print it as if i myself would print it in the termial.