General :: Bash - Catch Or Stop A Shut Down From The Terminal?
Sep 12, 2011
Is there a way to catch or stop a Linux shut down after a reboot, halt or shutdown command has been entered?sudo shutdown -r +10 I should now have 10 minutes before the computer shuts down. If I change my mind and decide that I still want to continue running, how could I stop the shut down?
View 1 Replies
ADVERTISEMENT
Jan 26, 2009
I want to catch some outputs in two different log files in bash, file simple.log and all.log So far, the script is started like this:
Code:
xterm -e "(./myscript.sh | tee -a simple.log) >& all.log"
What I want is:
- In simple.log, I want all the stdout but WITHOUT errors.
- In all.log I want BOTH stdout and stderr.
So all is ok, and the output becomes:
all.log
Code:
starting copying files
mv: cannot move ... : permission denied
copying completed
simple log
Code:
starting copying files
copying completed
But, in the new xterm, I'm loosing stdout. There is no output.How can I have the files logged as they are but also have the stdout in the xterm.
View 6 Replies
View Related
Oct 30, 2010
How do you catch user input while the script is running? Or, how would you make two scripts run at the same time, but use input from one script to the other? The program I'm trying to make, echos text on the screen continuously, but while thats happening, I want the user to be able to input something, so the program can detect the input and display something else. So I thought maybe I could make two scripts run to do each task.
View 5 Replies
View Related
Apr 21, 2010
I have the following working script. It checks the directory for txt files, if files are there, it copies to another directory or gives error. I would like to exclude "file not found" errors and send them to /dev/null. All other errors should go to the email address as usual.
Code:
#!/bin/bash
function err
{
if [[ $? -ne 0 ]]
[Code]....
View 7 Replies
View Related
Nov 18, 2008
I have a machine running Hardy that is restarting itself when "shut down" is selected. happens everytime and this just started yesterday. OS has been on the machine for months, very confused.
View 3 Replies
View Related
Feb 17, 2010
When killing a process with kill -9 $PID &>/dev/null in a script, a message is still printed to the terminal after the next command terminates.
View 3 Replies
View Related
Mar 31, 2010
i would like to ask something very simple i hope for most off you but i couldn't find anything in other questions so specific...
So...i need a command to stop another command.
more specific i have to run airodump-ng and i want this command to stop after some seconds (or minutes) automatically....
View 6 Replies
View Related
Jan 4, 2011
I moved from a Linux environment from one company to another and one annoying difference came out:When I used to run an application in a terminal (no GUI), the transcript lines were presented one the window - when the window was full then the scrolling of the lines would continue only if one hit the space bar to proceed (of course waiting to user input did not stop the run).
In the new environment the behavior is different - transcript lines keep going on and on so I need to scroll up - and moreover each page-up command is cancelled by the new lines appearing.perhaps this is also reproduce with other Linux commands , say "find" or "ls".
View 4 Replies
View Related
Mar 18, 2010
Im used to using nautilus within centos but have recently just got a VPS and quickly realising that using a KDE is unacceptable in this environment. Although I do find it so much quicker doing things like folder permissions in KDE rather than typing it all out in the terminal? Everyone I speak to says, use the terminal and I should learn this way as opposed to using the KDE, but theres certain things I just dont get
How is it possible to make quick changes to scripts and viewing them in a browser etc , without a mouse or using KDE? and only using a terminal?? I am wondering how to develop websites just using the terminal?
How can it be quicker to type out/view permissions etc in the terminal when its instant and just a few clicks in the KDE?
View 3 Replies
View Related
Mar 1, 2011
1- I m having duel boot win xp and ubuntu...most of internet downloading i do from ubuntu....i know windows virus dont run on ubuntu even they come but what about my windows partition.....is that gets affected?
2- How to shut down computer from terminal? i want to specify time also.means at 12pm it should get shutdown something like that....but before getting shut down it should close all application if possible.
View 8 Replies
View Related
Jun 23, 2011
I want to be able to time how long I spend in front of a terminal. I'm thinking the best way will be to have some sort of timer that starts and stops when the terminal gains/loses focus. And it will have to work with multiple terminals...
I'm using GNOME.
View 3 Replies
View Related
Sep 10, 2010
I open up 2 xterms on my desktop, A(/dev/pts/0) and B(/dev/pts/1).I can write from A to B using redirection e.g. echo "test" > /dev/pts/1How do I run a command from A on B? e.g. "clear"Basically I'm putting the 2 terminals side by side, and using terminal B to display the contents of the current working directory, by running the following in A:export PROMPT_COMMAND="ls -a > /dev/pts/1"but this fills up the screen pretty fast. I was actually looking for a way to clear up the second terminal.
View 6 Replies
View Related
Feb 29, 2016
I mainly use debian jessie , recently i have installed daragora as my second os to get a feel of gnu/linux . the problem is that dragora uses bash , and it's commands are different from debian jessie terminal is there a way that i can use the same commands here in dragora?
View 4 Replies
View Related
Dec 10, 2010
Linux-goers. I did some research on this, but I am still fairly new to Linux. In Ubuntu 10.10 (Maverick), I accidentally overwrote my "/bin/bash" file. Dude, using "sudo" with a small typo can work disasters. Bash is now broken in the Terminal (gnome-terminal). Terminal itself still works fine, technically, but bash is still hosed/broken. Here is what I did to try to fix it: Booted from Ubuntu 10.10 live CD. Mounted my Ubuntu partition and manually copied the good/fresh "bash" file onto my hard drive. Verified copy was successful. Didn't help, as you see. Reinstalled "gnome-terminal" using synaptic package manager. Tried to reinstall bash via synaptic, it failed with error, "E: /var/cache/apt/archives/bash_4.1-2ubuntu4_i386.deb: subprocess new pre-removal script returned error exit status 2"
In Terminal, all basic commands work as far as I can tell. ("ls", "pwd", navigation, etc.) Here are some problems:My "username@computername" does not display in the prompt; only the $ sign. Bash keyboard shortcuts such as uparrow and tab do not work. Instead, each inserts a key code. I can't even move the cursor left/right. Aliases (a function of bash and .bashrc) are broken, of course. My sanity level decreases when I use Terminal now. For what it's worth, even with "sudo" I get a "permission denied" error when trying to run Google Chrome! I read something about a ".bashrc" file being a possible problem, but I don't know how to make it work, or the file's proper locations in Ubuntu 10.10. Is there something I can do with a "make" or "apt-get install" command or something?? Could this simply be a permissions problem? Is the link to "/bin/bash", "/bin/sh", or a ".bashrc" file broken? Guide me, oh Linux gurus.
P.S. I always wondered what exactly bash was and how it was different from the basic terminal. LoL, this is an excellent way to demonstrate the difference, and I WANT IT BACK!
View 9 Replies
View Related
Jun 5, 2011
I got a problem with terminal, since i'm really a noob with terminal i don't know how to fix it.Everytime i type in a command it shows for example:
-bash: ls: command not found
Even the basic commands don't work... just cd <directory> and those things works
View 9 Replies
View Related
Feb 27, 2011
Is there a way to get colored output when using tab completion in a terminal? My colors are fine everywhere else so I know that I've enabled a color terminal successfully. Using bash in Ubuntu (10.10).
View 1 Replies
View Related
Feb 17, 2011
I'm really running into a wall trying to figure this out. I have a Bash script and narrowed down the one command that doesn't seem to work via cron and it's my pgp decrypting line. Works fine if I run the command via terminal but if I run it via cron it doesn't output anything.crontab -e shows the cronjob and it runs, creates the log file with no output. Is there maybe something I need to run as well? Permissions look set, unless the cron is running as a different user(was under the assumption if it showed up under crontab while logged into that user, then it would run as that user.
View 14 Replies
View Related
Jan 19, 2010
This code:
Code:
#! /bin/bash
echo Okay.
echo
Does not do it....
P.S. I want to show my parents what happens when I do:
Code:
sudo make me a sandwich
and have it say "Okay."
View 11 Replies
View Related
May 11, 2011
My terminal is showing bash-2.3-$ instead of Username@computename.
View 5 Replies
View Related
May 3, 2015
I have recently updated my GNOME installation from 3.x to 3.14. Suddenly, there are many glitches. The power buttons on the power menu does nothing, I am forced to shut down via the terminal, everything goes black every now and again, and there is a weird colour pattern behind some icons when I hover over them. But most importantly, the icons and text do not show up on the "Activities -> Show Applications -> All" menu. They still there, as you can see the opening animation before they disappear, and I can click on them, but you just can't see them. The "Frequent" menu works fine. Here is a YouTube video I have made to explain my problem.
[URL] ...
I did change the icons, but this was after these problems started happening, and so it should be un-related.
View 14 Replies
View Related
Jun 17, 2010
I would like to make a shell script that will do the following :- have a web-page using curl- download a picture from the web-page- have a line in the source code of the web page
- catch a string (a link patch) from the line- go to another page of the website from the result of the previous step- repeat all this until there is no match for step 3I know how to :- have the web-page source code using curl (simple, we just have to make "curl- download the picture (as simple as the first step)- have a line in the source code (grep is made for that, isn't it ?)- go to another website from the result of the previous step (it's the same as the first step)But I really don't know how I can do the fourth step of my script.
In facts, I don't know regular expressions and even the shell command that can help me to do this.To be more clear, I would like to store in a variable the string represented by the star (*) in this : <a href="*">Next ></a>
View 12 Replies
View Related
Oct 26, 2010
I know how to redirect the output of a terminal to a file. For example, if I want to list all the files in ~/Documents and output to a file called test.txt, I would do this: ls ~/Documents > test.txt The question is, can I copy the output to test.txt AFTER I have carried out the command? This would mean that I wouldn't have to know in advance whether I want to copy the output to file. I want to do something like this: ls ~/Documents Then this: <bash command for copying standard output to test.txt>
View 2 Replies
View Related
Jan 2, 2011
How to select text in BASH terminal using the keyboard without mouse? I'm using Ubuntu 10.10
View 1 Replies
View Related
Jun 25, 2011
I want to be able to synchronise files between 2 remote computers in both directions. Say for example that I want to synchronize my /home/Documents directory with <username>@example.com:/home/Documents What's the easiest way to update the folders in both directions, so that new/updated files on my home computer get transferred to the remote computer, and new/updated files on the remote computer get transferred to my home computer?
View 2 Replies
View Related
Jan 12, 2010
i want to delete some say 10 previous commands in bash shell!
View 3 Replies
View Related
Dec 10, 2009
I have 3 script BASH. I want start this script when the system start,stop and reeboot.
View 4 Replies
View Related
Mar 13, 2011
$ 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?
View 1 Replies
View Related
Jul 18, 2010
I have a Linux CentOS server.Is there a way to store all changes made to the hard drive by all software on the server ?
View 14 Replies
View Related
Aug 5, 2010
I would like to know a how to write Perl script to catch all the content in between BEGIN: and END from input file could any body help?
View 9 Replies
View Related
Jan 15, 2011
I am trying to write a bash script that would save the current state of my konsole terminals and sessions. I'm using KDE3.X and for some reason the "profile" save does not save the current working directories... Anyway, I would like to know if there is an elegant way to obtain the current workdir of each terminal and session ? I've managed to do something with a clever use of DCOP extended functions, but it requires me to start every konsole with the --script option enabled, and I don't want to do that.
View 9 Replies
View Related