General :: Bash - Where And How Are Custom Startup Commands Configured
Jan 11, 2011
I'd like to add custom startup commands (for example starting a process, registering to a registration server, downloading a configuration file) to the Linux startup process. Those commands should be triggered on startup only. What is the standard/appropriate way to do this?
EDIT: Is /etc/profile the right place to trigger such things?
So I'm here thinking how to create custom commands on my Linux Debian? I mean so i could open up terminal and just type the script name (and possibly some arguments) and it would refer to the script in my home directory. Otherwise I've write the whole path to the script each time and it gets annoying.
I found that Linux Ubuntu has custom keyboard commands.his is awesome.What I'm trying to do, is make a command that will shut down the computer with a single button with no dialog windows.For you know, being grounded nd stuff.I found the command for it is "shutdown" with a few options.But when I tested it, being bound to pause/break, it did nothingAm I writing the wrong code, as I'm not using any options, or is this not possible?
What happens when the script executes is that the ssh connection works and parks me at the remote hosts's shell login. Therefore, the "firefox" command refuses to execute. I need to know how to make the "ssh" connection occur, stay open, and go into the background so that the rest of the script can execute.If I could also do this with the "firefox" line so that the entire term window could be closed would also be helpful.
I would be running SQL commands (UPDATE/SELECT) from within my bash script. I am completely new to this subject. Is MYSQL used for this purpose? Alternatively, what is sqlplus?
I know it's possible to change the $ user@hostname colors, but is it possible to color different things? Could I make all numbers/integers a certain color. Or set certain keywords to be bold?
This is a really odd bug I can't seem to figure it out. Basically, commands like ls can see all the files in the current directory, however when I go to execute the file it will give errors like "file not found", even when it most obviously is. If you look at my command history in the screenshot, you can see I can ls into a directory and see it's contents. When I try to run the file, I get the "no such file or directory" error.
However, if I type simply 'vm', I can't use tab completion to complete the directory name, and my third command is me typing 'vm' and hitting tabtab, it lists a bunch of vmware specific tools instead of the subdirectory name. I can then ls and see my current directory contents, and it will list only the single subdirectory. However, then I tried to use the full filepath from root to run the file, still to no avail. If anyone has any insight,
is there any way I can pass commands to the CLI of a tool directly?
I would like to script some actions, for example:
./OpenBTS < "tmsis"
I do not need to retrieve the results (I watch it in the log file). how I could realize that? There is now way to do this using command line parameters, at least not that I found out. So it looks like I have to figure out sth myself. Maybe I could automate screen in a way to detect the prompt and "paste" my command there. Are there tools for this on Linux?
I made a script that contains repetitious commands (snmpget and awk are the only ones at the moment. Running these commands from standard terminal work, but when run within a script, I get:
./reg_sm_count: line 10: snmpget: command not found ./reg_sm_count: line 10: awk: command not found ./reg_sm_count: line 10: snmpget: command not found
I'm creating a bash script that contains the following line:"ssh user@$server1 cd /tmp; pwd"What I want is to print /tmp of server1, but the script it isn't printing that
I wrote a simple bash script to let me treat any set of programs like a deamon. For example if I configure the script a certain way I can start/stop/get the status of apache, mysql and php all from one command. I am having a bit of a problem though. I am passing commands as strings to a function and then depending on the arguments to the script it might run one of these commands or another. Some of these commands need to beun in the background though, such as deluge-web. When I send "deluge-web &" to the function and it execute it deluge-web does not start in the background. I can't figure out why this is. I have tried escaping the & with ''s and with a , but nothing seems to work. I know that this is some idiotic thing that I am overlooking, but I am a bit stumped. Here is the script configured to start/stop/get status of deluged and deluge-web.
This problem has been there since I upgraded to FC12 from FC11 (I use Gnome). There are two applications that launch automaticaly when I logon:A nautilus window pointed at computer:////RythmBox minimized to notification panel.And they aren't in System/preferences/startup applications
$ execute_some_long_command <command is executing> <Accidently press middle button that inserts bunch of garbage (including, for example, `rm -Rf ~/*`) into console>
How to let execute_some_long_command finish, but not execute inserted things?
I'd like to know if there is a way to define commands in the .bashrc or .bash_profile. For instance, I want to be able to type 'work' in a terminal and set up an interactive work environment on my universities cluster. (This is done with the command 'qsub -I -X'.) I tried the following in my .bashrc file:
alias work ='qsub -I -X'
But, of course this failed, as I don't have a command work already defined. How do I go about doing this? Also, I can't assign 'qsub' an alias, since it's used with different options quite extensively.
I need to process billions of small files using bash shell commands with limited memory size (256MB). If any of those files contain certain "keywords", the file will be removed. I tried with command:
I would like to run a few custom commands when booting: "xinput" to calibrate the touchscreen and a couple of "setkeycodes" to make special buttons responsive.
From within a session I need to do "sudo setkeycodes [etc]" - without root access there's a "couldn't get a file descriptor referring to the console" error message.
Ideally these commands would already be operational at the login screen, and without requiring entering a root password every time.
I've put the commands in an otherwise empty /etc/rc.local but this does nothing. Other posts mention bootscript.sh but I don't get how this is used; and the best way to do this seems to have changed between versions - so what's the proper Lucid way?
I didn't change anything; it just stopped working on boot. I've changed permissions according to messages from log files. No good.I now get messages saying "unable to open display ' '." If I set the display (I've done this several ways, the messages say "unable to open display ':0'."
Systemd is taking control of everything basic, with almost no documentation and no configuration tools at all: rationalization by lunatics.You can make a script to run commands on boot using systemd on Jessie by creating two files: the script, in any location a file in /etc/systemd/system that runs that script..My script is called james-boot.service, placed in my /home/james/.bin directory.
#! /bin/sh # this is run by /etc/systemd/system/james-boot.service # Enable with sudo systemctl enable james-boot.service # Check with sudo systemctl status james-boot.service # If it says the service is loaded, it's OK -- inactive only means it's done running.
[code]....
This file must have ownership root.root, with (apparently) permissions 664 (rw-rw-r--).After creating, enable with sudo systemctl enable james-boot. service.Check with sudo systemctl status james-boot.service. If it says the service is loaded, it's OK -- "inactive" only means it's done running.
I created a script, named mount_share.sh (in /etc/init.d), to mount the shared VirtBox dir at boot so I don't have to do it manually every time I load the VM. The script contains the following:
#!/bin/sh sudo mount -t vboxsf -o uid=1000 osx_shared /home/rob/ubuntu_shared
I made it executable:
sudo chmod +x mount_share.sh
Then I assigned it to run at startup:
sudo update-rc.d mount_share.sh start 51 S .
I'm thinking it may be either:
1) A pathing problem to the ubuntu_shared dir but, if I run "ls -al" from inside /etc/init.d, it does find the ubunt_shared dir
2) Trying to run as sudo from inside the script. But, since all startup scripts run as the root user, I shouldn't even need the "sudo" in there which I have tried to no avail.
What I want to do is create a custom live USB startup of ubuntu.
I know how to create a usb startup from the iso (any ubuntu iso), with the usb startup disk tool.
Is it possible to add some software to it, for example suppose I want it to have exaile and wireshark (or any software) already installed. How can I do that ?
how to execute commands on startup. I've added lines to /etc/rc.d/rc.local, /etc/rc.local, I've put scripts (with extension .sh) into /etc/init.d/ and I've set the executable permission thing on all of them with chmod -x. I *still* can't get anything at all to execute on startup. The truth is, I'm trying to enable multitouch and button tapping automatically when I startup Fedora. I have the commands
[code]...
Which I want to execute whenever I start Fedora (it's a bit tedious to write them every time, or even to have to execute a script myself whenever I start my computer). Furthermore, if I can figure this out, then I can do all sorts of things. Does anyone have a clear, surefire way in which I can do this? I'm not good with using Linux at all
I have a question regarding terminal. I try to launch it from the "Startup Applications" by entering a script.Code: sh -c '/usr/bin/gnome-terminal'but it does not start.Also, when it does start I would like it to auto run certain commands: navigate to my project folder run "play test" open a new tab run "top".how can I achieve this?
I am new to XFCE and I'd like to ask few question about usage: 1. How can I disable dragging windows through workspaces? I like them to stay at one. 2. How do you configure startup applications? 3. Why XFCE menu doesn't show some of my custom icons? (png, tried more than one, for custom launcher - eclipse) 4. How do I add custom keyboard? (ALT+SHIFT switching) 5. I restarted laptop and all my applications re-opened after restart. I do not want that. How to disable this?
I'm setting up a scheduler to run some bash script commands but they won't run when I point them to a script file. If I change the cron to call
[code]...
If I run ./writeTimeToLog from the terminal - it, well, writes the time to the log file! I then use
[code]...
to test I can schedule this to run every minute just so I can see it working. the entry was a basic as I could make. It adds the cron successfully but never seems to update the file. Where would an error be put if one occurred.
I would like to be able to connect to a machine, list a directory, wait long enough for me to see the results then move on to the next machine.This is failing: