Search Results

Search found 24211 results on 969 pages for 'shell command'.

Page 16/969 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • linux shell, keep task alive for specified time

    - by liori
    Hello, I am looking for a tool to keep a task alive (restarting if necessary) for a specified amount of time (in seconds), and then kill it and stop. For example: keep_for 3600 rsync foo bar:faz should for try to synchronize a directory (restarting rsync in case of f.e. dropped connection), but explicitly kill rsync and stop respawning it after an hour. I tried to write a shell script for that, but it was surprisingly difficult to write, with lots of edge cases (like child process not getting killed, or shell escaping issues). So... maybe there already is a tool for that?

    Read the article

  • Ubuntu from console/command-line/shell

    - by Xolve
    Earlies linux distros though required lot of manual work they were quite good to use from commandline. If the X-server didn't start or you just want a shell to work they all supported. Network was configured by init; sound was up and ready; new devices inserted would be configured and their configureation was placed in fstab. Also there were small scripts I found on many distros which on X used windows while on console they switched to ncurses. But now this all needs GUI with a desktop manager (KDE, GNOME) for the new paradigms :'-( require GUI (NetworkManger, hal etc.). So if on just command line you have to be root, looks like they believe only geeky admins need that, and need to edit config files or type big commands. Any way so that this is easy in Ubnubtu through shell again.

    Read the article

  • Shell script only executes partially when run with CRON

    - by binaryorganic
    I've written a shell script that does the following: Retrieve mail from a POP3 account (using GetMail) Save a copy of that email to S3 (using AWS CLI) Email me the filesize of the email The script runs fine manually, and technically runs from CRON, but it only seems to be sending the email. The getmail and S3 bits don't seem to run. Everything I've read seems to hammer home the message that I need to be careful about relative paths and the like when using CRON, but I think I'm using absolute paths everywhere I need to be, so I'm stumped as to what the issue could be. My Shell Script is here: #!/bin/bash # Run GetMail getmail -r /PATH/TO/EMAIL/getmail.email # Save to S3 aws s3 cp /PATH/TO/SCRIPT/email-backup.mbox s3://XXXXXXXXXX/email-backup.mbox # Send Confirmation Email SUBJECT="EMAIL SUBJECT" EMAIL="[email protected]" # Get current filesize FILENAME=/PATH/TO/SCRIPT/email-backup.mbox FILESIZE=$(stat -c%s "$FILENAME") # Email Content EMAILMESSAGE="/tmp/emailmessage.txt" echo "EMAIL BODY" >$EMAILMESSAGE echo "" >>$EMAILMESSAGE echo "Current File Size: $FILESIZE bytes" >>$EMAILMESSAGE # Send the Mail /bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE

    Read the article

  • Windows Shell Programming book suggestion

    - by Lijo
    Hi, I am a web developer using C#. I would like to experiment with Windows shell programming in C#. Many people suggests that using managed applications for shell program, is dangerous. (Creation of separate instances for each process versus in process shell. Also version dependency) Frankly speaking, I am totally new to shell. Is there a book available, that will treat these topics; both through managed code and unmanaged code (but mostly towards managed code)? It would be great if that book is concise , for beginner and giving theoretical background of the shell. Please suggest…. Thanks Lijo

    Read the article

  • How to debug a .bash_profile

    - by Blankman
    I was updating my .bash_profile, and unfortunetly I made a few updates and now I am getting: env: bash: No such file or directory env: bash: No such file or directory env: bash: No such file or directory env: bash: No such file or directory env: bash: No such file or directory -bash: tar: command not found -bash: grep: command not found -bash: cat: command not found -bash: find: command not found -bash: dirname: command not found -bash: /preexec.sh.lib: No such file or directory -bash: preexec_install: command not found -bash: sed: command not found -bash: git: command not found My bash_profile actually pulls in other .sh files (sources them) so I am not exactly sure which modification may have caused this. Now if I even try and to a list of files, I get: >ls -bash: ls: command not found -bash: sed: command not found -bash: git: command not found Any tips on how to trace the source of the error, and how to be able to use the terminal for basic things like listing files etc?

    Read the article

  • Launch only the command if the previous one worked inside SSH, SHELL

    - by Namari
    I've got a SHELL script which is using a pipe to separate my 2 commands: ssh -oBatchMode=yes user@hostname "mysql -u yop -pyop -c yop | echo test" The problem is even if my connection to mysql doesn't work, it send the echo test. I would like to forbid my script to send any command if the previous command doesn't work. I search with a if condition but it seems it not possible with it :( Does anyone have an idea ? Thanks, Namari

    Read the article

  • Any way to list similar commands?

    - by Septagram
    When you write the command name wrong, bash often does this: septi@norbert:~$ good No command 'good' found, did you mean: Command 'gold' from package 'binutils' (main) Command 'gmod' from package 'gmod' (universe) Command 'goo' from package 'goo' (universe) Command 'god' from package 'god' (universe) Command 'geod' from package 'proj-bin' (universe) Command 'gord' from package 'scotch' (universe) good: command not found Or sometimes it does this: septi@norbert:~$ nftp No command 'nftp' found, but there are 23 similar ones nftp: command not found Is there any way to ask bash to show these 23 similar commands for me? And, is there a way to show similar commands, including those that aren't yet installed, instead of running the application, ftp for example?

    Read the article

  • Running a command line app with sudo and password automatically on OS X startup

    - by Designer023
    I need to run an app at startup/login on my mac. I want it to launch in the background and start doing it's work without interrupting me or me having to start it up because I invariably forget and then when I need it, it wasn't running! I have tried using AppleScript to tell Terminal to run it and type my password in, but it ends up opening multiple Terminal windows and not working. Ideally I need a script that I can just add to the user login items and it will run for me. The app has no way of taking a password argument either and it has a password as well as the sudo! I need a solution that can either be done as an applescript (which can be made into an executable) or i need a commandline script but I have no idea about them. This is the manual code I type $ sudo serverStatus password:123456 password:serverpass My AppleScript: tell application Terminal activate do shell script "sudo serverStatus" delay 5 do shell script "123456" delay 2 do shell script "serverpass" end tell

    Read the article

  • how to add a function to that program, and call that function from the command line in the function

    - by user336291
    a#include "smallsh.h" /*include file for example*/ /*program buffers and work pointers*/ static char inpbuf[MAXBUF], tokbuf[2*MAXBUF], *ptr = inpbuf, *tok = tokbuf; userin(p) /*print prompt and read a line*/ char *p; { int c, count; /*initialization for later routines*/ ptr = inpbuf; tok = tokbuf; /*display prompt*/ printf("%s ",p); for(count = 0;;) { if((c = getchar()) == EOF) return(EOF); if(count<MAXBUF) inpbuf[count++] = c; if(c == '\n' && count <MAXBUF) { inpbuf[count] = '\0'; return(count); } /*if line too long restart*/ if(c == '\n') { printf("smallsh:input line too long\n"); count = 0; printf("%s",p); } } } gettok(outptr) /*get token and place into tokbuf*/ char **outptr; { int type; *outptr = tok; /*strip white space*/ for(;*ptr == ' ' || *ptr == '\t'; ptr++) ; *tok++ = *ptr; switch(*ptr++) { case '\n': type = EOL; break; case '&': type = AMPERSAND; break; case ';': type = SEMICOLON; break; case '#': type = POUND; break; default: type = ARG; while(inarg(*ptr)) *tok++ = *ptr++; } *tok++ = '\0'; return(type); } static char special[]= {' ', '\t', '&', ':', '\n', '\0'}; inarg(c) /*are we in an ordinary argument*/ char c; { char *wrk; for(wrk = special;*wrk != '\0';wrk++) if(c == *wrk) return(0); return(1); } #include "smallsh.h" procline() /*process input line*/ { char *arg[MAXARG+1]; /*pointer array for runcommand*/ int toktype; /*type of token in command*/ int narg; /*number of arguments so far*/ int type; /*FOREGROUND or BACKGROUND*/ for(narg = 0;;) { /*loop FOREVER*/ /*take action according to token type*/ switch(toktype = gettok(&arg[narg])) { case ARG: if(narg<MAXARG) narg++; break; case EOL: case SEMICOLON: case AMPERSAND: case POUND: type = (toktype == AMPERSAND) ? BACKGROUND : FOREGROUND; if(narg!=0) { arg[narg] = NULL; runcommand(arg, type); } if((toktype == EOL)||(toktype=POUND)) return; narg = 0; break; } } } #include "smallsh.h" /*execute a command with optional wait*/ runcommand(cline,where) char **cline; int where; { int pid, exitstat, ret; if((pid = fork()) <0) { perror("smallsh"); return(-1); } if(pid == 0) { /*child*/ execvp(*cline, cline); perror(*cline); exit(127); } /*code for parent*/ /*if background process print pid and exit*/ if(where == BACKGROUND) { printf("[Process id %d]\n", pid); return(0); } /*wait until process pid exists*/ while( (ret=wait(&exitstat)) != pid && ret != -1) ; return(ret == -1 ? -1 : exitstat); } #include "smallsh.h" char *prompt = "Command>"; /*prompt*/ main() { while(userin(prompt) != EOF) procline(); }

    Read the article

  • MySQL – How to Find mysqld.exe with Command Prompt – Fix: ‘mysql’ is not recognized as an internal or external command, operable program or batch file

    - by Pinal Dave
    One of the most popular question I get after watching my MySQL courses on Pluralsight is that beginning users are not able to find where they have installed MySQL Server. The error they receive is as follows when they type mysqld command on their default command line. ‘mysql‘ is not recognized as an internal or external command, operable program or batch file. This error comes up if user try to execute mysqld command on default command prompt. The user should execute this command where mysql.exe file exists.  If you are using Windows Explorer you can easily search on your drive mysqld.exe and find the location of the file and execute the above command there. However, if you want to find out with command prompt the location of mysqld.exe file you can follow the direction here. Step 1: Open a command prompt Open command prompt from Start >> Run >> cmd >> enter Step 2: Change directory You need to change the default directory to root directory, hence type cd\ command on the prompt to change the default directory to c:\ . Here we are assuming that you have installed MySQL on your c: drive. If you have installed it on any other drive change the drive to that letter. Step 3: Search Drive Type the command dir mysqld.exe /s /p on the command prompt. It will search your directories and will list the directory where mysqld.exe is located. Step 4: Change Directory Now once again change your command prompt file location to the folder where your mysqld.exe is located. In my case it is located here in folder C:\Program Files\MySQL\MySQL Server 5.6\bin hence I will run following command: cd C:\Program Files\MySQL\MySQL Server 5.6\bin . Step 5: Execute mysqld.exe Now you can once again mysqld.exe on your command prompt. You can use this method to search pretty much any file with the help of command prompt. Reference: Pinal Dave (http://blog.sqlauthority.com)Filed under: MySQL, PostADay, SQL, SQL Authority, SQL Query, SQL Tips and Tricks, T SQL

    Read the article

  • How To Run A Shell Script Again And Again Having X Interval Of Time?

    - by Muhammad Hassan
    I have a shell script in my Ubuntu Server 14.04 LTS at ./ShellScript.sh. I setup /etc/rc.local to run the shell script after boot but before login using below code. Run this: sudo nano /etc/rc.local then add following and save. #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. #!/bin/bash ./ShellScript.sh exit 0 Now I want to run/execute this shell script again and again having 15min of time interval between every run after boot but before login. So Can I do it? Update 1:) When I run crontab -e then I got the following. Now What to do? no crontab for root - using an empty one Select an editor. To change later, run 'select-editor'. 1. /bin/ed 2. /bin/nano <---- easiest 3. /usr/bin/vim.basic 4. /usr/bin/vim.tiny Choose 1-4 [2]: After selecting 2, I got crontab: "/usr/bin/sensible-editor" exited with status 2 UPDATE 2:) Update ShellScript.sh like below... #!/bin/bash # Testing ShellScript... while true do echo "ShellScript Start Running..." ********************************** All My Shell Script Codes/Script/Commands ********************************** echo "ShellScript End Running..." exit 0 sleep 900 done Then Run this: sudo nano /etc/rc.local then add following and save. #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. sh ./ShellScript.sh & exit 0

    Read the article

  • Gnome-Shell panel disappeared - How to get it back?

    - by Arindom
    I am on Gnome-Shell and using Ubuntu 11.10. The problem is after a recent update and also after installing a few extensions, when I logged in to Gnome Shell, I can't find the top panel or AWN. Only the wallpaper is showing and then Conky is displaying. It also seems to me that for some reason the display effects are not working and that is why AWN is not showing. Need your help to get back the panel.

    Read the article

  • Run shell script using fabric and piping script text to shell's stdin

    - by Peter Lyons
    Is there a way to execute a multi-line shell script by piping it to the remote shell's standard input in fabric? Or must I always write it to the remote filesystem, then run it, then delete it? I like sending to stdin as it avoids the temporary file. If there's no fabric API (and it seems like there is not based on my research), presumably I can just use the ssh module directly. Basically I wish fabric.api.run was not limited to a 1-line command that gets passed to the shell as a command line argument, but instead would take a full multi-line script and write it to the remote shell's standard input.

    Read the article

  • Open an Emacs buffer when a command tries to open an editor in shell-mode

    - by Chris Conway
    I like to use Emacs' shell mode, but it has a few deficiencies. One of those is that it's not smart enough to open a new buffer when a shell command tries to invoke an editor. For example with the environment variable VISUAL set to vim I get the following from svn propedit: $ svn propedit svn:externals . "svn-prop.tmp" 2L, 149C[1;1H ~ [4;1H~ [5;1H~ [6;1H~ [7;1H~ ... (It may be hard to tell from the representation, but it's a horrible, ugly mess.) With VISUAL set to "emacs -nw", I get $ svn propedit svn:externals . emacs: Terminal type "dumb" is not powerful enough to run Emacs. It lacks the ability to position the cursor. If that is not the actual type of terminal you have, use the Bourne shell command `TERM=... export TERM' (C-shell: `setenv TERM ...') to specify the correct type. It may be necessary to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.svn: system('emacs -nw svn-prop.tmp') returned 256 (It works with VISUAL set to just emacs, but only from inside an Emacs X window, not inside a terminal session.) Is there a way to get shell mode to do the right thing here and open up a new buffer on behalf of the command line process?

    Read the article

  • Need help creating advanced context menu command in Windows 7 (x64)

    - by Craig
    I found out about ForceBindIP and I really love it, so much that I am using it regularly enough to where spamming the same command prompt over and over again is getting painful. Here's ForceBindIP and what it does: http://www.r1ch.net/stuff/forcebindip/ I'm on a 64-bit of Windows 7 Home Premium. What I want to do is add a right-click context menu item so that when I browse items in Windows Explorer, or on my desktop, I can automate a ForceBindIP command (through the prompt). I am permanently connected to two networks: one over ethernet, and one over wireless. My ethernet network takes priority. What I want to do is add a "Run through wireless network" context menu item, that will send the item through this command: ForceBindIP {5F657824-9E3B-46E5-C21E-F52585R6457E} "[path to right-clicked file here]" It will need to run that command in C:\Windows\SysWOW64. I've no experience at all playing with the Windows registry or writing batch files, anything of that sort. I was wondering if anyone here would be kind enough to assist me?

    Read the article

  • How to add commands of windows to local shell of XShell 4

    - by dylanninin
    XShell is a very powerful tools to ssh remote computers such as Unix/Linux. And it has built some internal commands for you to run within your Windows. Xshell:\> help Internal Commands: new: Creates a new session. open: Opens a session or the session dialog box. edit: Opens the Session Property dialog box for a session. list: Lists information of all available sessions. 'ls' and 'dir' do the same. cd: Changes the current working directory. clear: Clears the screen/address/command history. help: Displays this help. '?' does the same. quit: Quits Local Shell. 'exit' does the same. ssh: Connects to a host using the SSH protocol. telnet: Connects to a host using the TELNET protocol. rlogin: Connects to a host using the RLOGIN protocol. sftp: Connects to a host to transfer files securely. ftp: Connects to a host to transfer files. External Commands: ipconfig: Configures TCP/IP network interfaces. ping: Sends ICMP ECHO_REQUEST packets to network hosts. tracert: Prints the route packets take to network host. netstat: Displays current protocol statistics and current TCP/IP network connections. nslookup: Resolves a hostname to IP address. For more information, type 'help command' for each command. ex) help telnet But these commands are limited, so how to add commands of windows to local shell of XShell 4

    Read the article

  • -bash: ls: command not found at Terminal on MAC OS

    - by art.mania
    I need to start using GIT for my projects from now on and I need to use some UNIX commands. but no matter what I do, I always receive "command not found" error. I installed MacPorts, but still cant run any UNIX command :/ When I try ls, I get the error below, same for sudo, or any other command: -bash: ls: command not found and when I try $PATH, I get the lines below: hakan-yilmaz-MacBook-Pro:~ hakanyilmaz$ **$PATH** -bash: /opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.6/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/opt/subversion/bin/:PATH: No such file or directory I'm on Mac OS X 10.6.6 I spent 2-3 days and kept googling and trying everything I found at forums, but no success. SOLUTION: I opened .bash_profile with TextWrangler and removed everything else than export PATH=/opt/local/bin:/opt/local/sbin:$PATH Then, I reboot that Mac, and WORKING!!!!

    Read the article

  • execute a command in all subdirectories bash

    - by Luigi R. Viggiano
    I have a directory structure composed by: iTunes/Music/${author}/${album}/${song.mp3} I implemented a script to strip my mp3 bitrate to 128 kbps using lame (which works on a single file at time). My script looks like this 'normalize_mp3.sh': #!/bin/bash SAVEIFS=$IFS IFS=$(echo -en "\n\b") for f in *.mp3 do lame --cbr $f __out.mp3 mv __out.mp3 $f done IFS=$SAVEIFS This works fine, if I go folder by folder and execute this command. But I'd like to have a "global" command, like in 4DOS so I can run: $ cd iTunes/Music $ global normalize_mp3.sh and the global command would traverse all subdirs and execute the normalize_mp3.sh to strip all my mp3 in all subfolders. Anyone knows if there is a unix equivalent to the 4dos global command? I tried to play with find -exec but I just managed to get an headache.

    Read the article

  • Win7 Command Prompt drives not available

    - by jmerrill
    I have the opposite problem compared to the author of this question: Hard drive access denied from Windows Explorer (but works from command prompt as Admin) I can see all the drive letters for a particular server in Windows Explorer, and can navigate through them exactly as would be expected. The drive letters are displayed in Explorer in parens to the right of the path info -- finalpathportion (\\server\otherpathportions) (driveletter:) e.g. jmerrill (\\server\users) (H:) But the drive letters are not usable in a "Run as Administrator" command prompt. They have worked in the past, but I have since rebooted. I thought that perhaps I had to start a new command prompt having visited them in Explorer -- but that did not help. "net use" in the command prompt shows Unavailable H: \\server\users\jmerrill Microsoft Windows Network with similar info for the other drives. I can do net use h: /d net use h: \\server\users\jmerrill for each drive, and get the letters to be available in the command prompt. It is perhaps obvious that I don't think that it should be necessary to do that. Does anyone have any ideas?

    Read the article

  • Disconnect VPN Using the Command Line

    - by Dave Johnson
    I make VPN connections using Vista's Connection Manager, and would like to disconnect the VPN connection from the command line so I can create a shortcut command called vpn.disconnect in Promptu Launcher. How can I disconnect the VPN connection via the command line?

    Read the article

  • Use Windows Briefcase from the command line

    - by Daniel
    I have a thumb drive on which I take many of my files with me. I would like to synchronize it with my computer automatically when I connect it. I currently have a script run every time I connect it so that I can do the many things that need to be done when it connects (check for updates to the portable applications, etc.). I want my synchronization utility to: Detect conflicts work correctly when I move files or change the folder structure tell the difference between a file that was deleted on one side and a file that was added on the other work from the command line or at least have a command that will open up a window provide a confirmation screen before doing anything The Windows Briefcase does all of these except the command line. Is there any program that does all of these, or is there a way to synchronize the briefcase from the command line?

    Read the article

  • disable possword policy using command prompt in Server 2008

    - by user50273
    Is there a way to disable password policy in Windows Server 2008 using command prompt. I know how to do it using Local Security Policy in Administrative Tools. I was wondering if there is a way to change using command prompt. I guess there must be some registry settings that needs to be changed but I do not know which entry in registry will disable the password policy. If you can tell me which registry entry I can write the command prompt myself. Thanks

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >