Tag Info

New answers tagged

0

I am not familiar with ipaddr, so I can only answer in general, with the title of your question as a starting point: Looking at the command you use (in your post) you do not use the extension .py. If you do not use it in your command, you should remove it from the script itself as well (and make it executable indeed). I looked into the name of the script, ...


1

Since ipaddr.py is library for inspecting and manipulating IP address, the first thing you'll want to do is create some objects. You can use ipaddr to create objects from strings, integers or other ipaddr objects. Check the following wiki page for examples: http://code.google.com/p/ipaddr-py/wiki/Using3144 Depending on your needs, installing the ...


3

You can try using rsync: rsync -av --include="*/" --include='*.png' --exclude='*' parent1 parent2 this creates directory parent2 and copies all files with .png extension with subdirectory structure to it. explanation -v verbose to see whats copied -a archive mode (copy subdirectories with same ownership, permissions etc.) --include '*/' ...


2

Copy parent1 to parent2 Remove dat files from parent2 subdirectories Remove png files from parent1 subdirectories $ cp -r parent1/ parent2 $ rm parent2/*/*.dat $ rm parent1/*/*.png


4

Try with the find command: find /media/Przenośny/transcode/* -exec transcode -J stabilize --mplayer_probe -i {} \; I have to wait ~1min after this message to see the next file to be transcoded: [decoder.c] cancelling the import threads 0:01:24, ( 4, 9| 0, 0| 6, 1) Redirecting with >> is useless as all the logs go to stderr and are pretty verbose ...


0

Use the screen command and -d detach from an existing screen session, and reattach here -m force a new screen session -S create a named session instead of using the default name


2

A bash script uses the same syntax as the standard command line in Ubuntu. If you can launch your game with moon-buggy (ie, it's installed in the path), it'll work in your script. If you've just downloaded the file (to, for example, ~/Downloads/moon-buggy), you'll probably need to make it executable with chmod +x ~/Downloads/moon-buggy and in your script, ...


1

I do not know what exactly is "content that I believe is appropriate". However, if you can run the script through terminal all you have to do is create a script with: #!/bin/bash cd /path/to/folder command-you-would-run-in-terminal Make the script executable. Then in your .desktop file, launch the script instead of your command directly. Example ...


0

Maybe service siemcy is not yet started, so you should first start it, and then restart it. Alternatively, you could copy your code in /etc/rc.local before the exit 0 tag. Hope it helps!


0

Most modern CPUs can adjust their clock frequency. The default governor on linux is "on demand" which keeps the clock speed low to save power when idle, and speeds it up to do work when needed. See https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt


1

That's a coincidence, it's your system changing the current cpu frequency. Check with this command in a terminal: watch -n 0 "lscpu | grep 'MHz'" You will see (when waiting a bit) that the system's cpu frequency is switching. You can also get your current cpu frequency with this command: cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq And ...


1

It's probably because ZIP is dos/windows-centric. In Windows, : is disallowed in filenames since it's used as separator between drive letter and path (C:\). Unless you really need zip, I recommend using tar with gzip or xz compression instead.


1

Here is a verbose solution as a python script. Not literally what you were asking for, but yet a solution: #!/usr/bin/python3 import os # change the lines below to the correct paths path_to_configfile = "path_to_configfile" # the real one in /etc/dhcp/dhclient.conf path_toconfigfile_a = "path_toconfigfile_a" path_toconfigfile_b = "path_toconfigfile_b" # ...


1

This sounds very much like a band aid and an XY Problem and you would be better off figuring out the core problem. Still, these commands will do what you need. I have written it as a shell function, not an alias, but just add these lines to your ~/.bashrc file: fix_config(){ ## Change current working directory to the directory where .config file is ...


6

This script allows you to enter a user that you are looking for. It will tell you whether or not the user is logged in or not and, if the user is logged in, from what location. read user This reads in the user name you entered `w | grep $user | cut -c19-30` The first part, w, prints out all logged in users accessing this machine. The grep $user filters ...


0

You can open it in your favorite text editor, or use a tool like cat or less. For example: cat /etc/script.pl


4

In the case =~ operator, just don't use quotes for the right operator. This is considered an extended regular expression so in this case the single quotes will be part from he regular expression. So, using single quotes, a string like '<img src="/thumbs/os_x_lynx-t1.jpg"' (which contain also single quotes around it) will be found. See Meaning of “=~” ...


3

If you write [[ "$page" =~ '<img src="[^"]*\.jpg"' ]], then the right-hand side will be treated as an ordinary string, not a regex. See Bash regex statement. The solution is to escape all the special characters. otherwise you can use regex statement in a separate variable within single quotes '' like, var='<img src="[^"]*\.jpg' in these case you ...


0

Problem solved. The cron job was running each night but not completing. The problem was with the script. The cron shell did not interpret "==" as equal, i.e. in the cron shell "1==1" was evaluated as false. However, when I ran the program at the command line it worked. I read somewhere that the bash shell understands == or = to mean equal... but the ...


1

I think what you want is wget http://server.com/scriptname.sh && bash scriptname.sh That will simply download the script locally and run it.


1

You can use: bash -c "$(curl -kL http://serverip/script.sh)" This will run the script on the local machine. See also man bash to understand why I used -c option. Also double quotes are very important in this case. Also, as @terdon said in his comment, sudo curl is pointless. If If the script needs local sudo permissions, you need to use sudo in front of ...


0

As suggested in Radu's comment, why not using ssh to start your script from your local server? First install openssh-server on your client system: sudo apt-get install openssh-server Then from your local server: ssh -t client_login@client_ip '/path_to_your_script/script.sh' The -t option in the ssh -t command force pseudo-tty allocation.


0

To rename a file, open Files and go to the folder the files are at. Then, left click on the file, and select Rename...


0

If there is the need to make interpolations and resizing there is room for errors, and similar (different resolution) images may be marked as duplicated. There is therefore the need for human verification. Take a look at imagemagick. The webpage looks ancient, but it's still good.


0

It seems you need to keep some secret in your script and it doesn't seems to be a right place for that. Think about that: script needs to be readable by the user to be interpreted by bash, how would you prevent user from copying the script, removing any checks from it and executing this modified version? You'd better use some external utility for password ...


0

If you do not need something, better turn it off, indeed. There are two things that you can generally do: 1) If you do not need PHP, then turn it OFF. Under Ubuntu you can see the list of modules that are turned on under /etc/apache2/mods-enabled/ Try: ls /etc/apache2/mods-enabled/ If you see entries such as php5.conf and php5.load, delete them. ...


0

It works like this: guake -n guake -e 'ssh 1' guake -r 'name_of_tab' This will open a new tab, execute the command (ssh 1, in this case) and rename the newly created tab to "name_of_tab".


1

Here is the script you want. Enjoy! #!/bin/bash # License: GPL-2 # by desgua # 2014 April 10 # # This script is provided "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. # # Always backup your files # ...


0

My money's on Benoit for having the truly correct answer here, but as soon as you can verify that your script executes you will likely find some additional errors. In short, make sure you also check your environment! You're half way there by using variables that define the location of the commands (MYSQL="$(which mysql)") but which mysql just reads your ...


0

Ensure to run: sudo crontab -e (or crontab -e as root) And add the desired script: */15 * * * * /bin/bash /home/wayne/scripts/mysql_backup.sh This will initiate the cron every 15 minutes, obviously you may want to change that.


1

Unless you've skipped some characters when writting the syslog output in your question, it looks like you've made a typo in your CRON command by forgetting the / in front of the command that should looks like : /home/wayne/scripts/mysql_backup.sh


1

wget --content-disposition URL Update: This is supposed to be the command but according to the man page it is experimental. It may not work. You can use wget --no-clobber "URL". What this does is skips any files that you already have. Though I am bit confused. If you already have the URL to the exact filename, how could the version be different? I would ...


0

Try this: DEST_DIR="/home/user/Ubuntu One/backup" tar -vczpf "${DEST_DIR}/${FNAME}-${TIMESTAMP}.tar.gz" ${SRC_DIR} >> ${LOG} The backslash does not escape inside doublequotes. There is no need to escape space bar inside doublequotes however.


5

Here is a solution using awk: $ awk 'BEGIN{FS="\n";RS=""} {r[$1]=$0} END{n = asort(r); for (i=1;i<=n;i++){print r[i] "\n"}}' restaurants Restaurant: Five guys City: Atlanta State: Georgia Address: 123 Peachtree Rd Phone: 9234211 Restaurant: KFC City: NYC State: NY Address: 123 Madison Square Phone: 95311 Restaurant: McDonalds City: Miami State: ...


3

By default, for bash, the command history are stored in ~/.bash_history file. As an alternative you can do this: #!/bin/bash date >> ~/myhistory.log cat ~/.bash_history >> ~/myhistory.log echo -n "" > ~/.bash_history This will append to ~/myhistory.log (if the file is already there, else create a new file and write to it) the date when the ...


2

Here's a simpler version of your script, (keeping the humor intact :) ): #!/bin/bash ## The && means that the script will run the next command only if this one ## succeeds, in other words, only if the string `version 1.0` is found. bleachbit --version | grep -q 'version 1.0' && echo "$(tput setaf 2)The elves have verified the BleachBit ...


1

I put this short script together that seems to work for me! This also include a bit of my own brand of elvish humor. I am using this code in a larger script so I can copy and paste this conditional anywhere I need it. #!/bin/bash # Check BleachBit Version and install if necessary if [ "$(bleachbit --version | grep -c 'version 1.0')" = "0" ]; then ...


0

OP wrote: It works great!!! select timings in /mnt/home/$USER/shell_logs/*.timing; do log="${timings%%.*}.log" clear echo "${txtred}Script gestartet${txtrst}" scriptreplay $timings $log echo "${txtred}Script beendet${txtrst}" done;; esac


2

The easiest way is if you can get there from the filename. For instance, if the selected filename is /mnt/home/$USER/shell_logs/20140326.log, you could get to another file in the same directory with a different extension, or another file in another directory pretty easily. Let's first look at stripping the extension off: ...


5

According to the man page for NetmorkManager, one of the events is dhcp4-change The DHCPv4 lease has changed (renewed, rebound, etc). I think you can simply change up) to dhcp4-change|up)


0

Although NetworkManager is using dhclient, it provides its own binaries as a replacement for the dhclient-scripts. (For reference: you can find the NM binary at /usr/lib/NetworkManager/nm-dhcp-client.action). Maybe you could take a different approach: NM is issuing an DBus signal on all events. You could listen on the system DBus for the appropiate event ...


1

This is the answer: #! /bin/bash #clear _temp="/tmp/answer.$$" STRING="" COUNTER=0 for i in $(ls /mnt/home/$USER/shell_logs/*.log ); do let COUNTER=COUNTER+1 STRING=$(echo $STRING $i \"$COUNTER\" \"OFF\" ) done dialog --backtitle "Radiolist" --radiolist "test" 0 0 0 $STRING 2>$_temp result=`cat $_temp` clear cat $result


4

This should work for you: sed 's/"//g' files.csv | while IFS=, read orig new; do mv "$orig" "$new"; done Explanation: sed 's/"//g' files.csv : remove the quotes IFS=, : split the input on , while read orig new; do ... done : This will read each input line, split it on the value of $IFS (here a comma) and save the 1st field as $orig and the rest as ...


0

To make it working, you have to add the list entries to a variable inside your for loop. Something like: #!/bin/bash COUNTER=1 RADIOLIST="" # variable where we will keep the list entries for radiolist dialog for i in /mnt/home/$USER/shell_logs/*.log; do RADIOLIST="$RADIOLIST $COUNTER $i off " let COUNTER=COUNTER+1 done dialog --backtitle ...


4

After googling and trying I have found this work around. Install arp-scan if you are not already: sudo apt-get install arp-scan now run this command: sudo arp-scan -l This will search the whole network for duplicate IPs. When two Ips are the same a keyword(DUP) beside the ouput line will be shown and thus you can know the duplicates: % arp-scan -N ...


-1

I don't know any programs for Ubuntu that do this, but Free Youtube Download (which is part of the Free Studio collection) can do this however it's a Windows program. Perhaps it will run in Wine? http://www.dvdvideosoft.com/products/dvd/Free-YouTube-Download.htm#.Uy_GiBASPmc


0

you used to be able to find plugins for your web browsers to do this for you. but i believe that YouTube/Googe has cracked down on this. i'm not aware of a way you can do this.


2

I don't know if there is a way to run things after entering your password as you request and I doubt there will be since that is handled by the desktop environment (probably the screensaver daemon). However, it should work perfectly well if you add the right scripts to /etc/pm/sleep.d. Since you have not shown the scripts you've tried, my guess is that you ...


0

steeldriver's comment makes sense. Given the line the error is on, it looks like you're trying to run an HTML file. Further I'm assuming you ran something like: wget http://git.openembedded.org/openembedded/tree/contrib/angstrom/omap3-mkcard.sh chmod +x omap3-mkcard.sh ./omap3-mkcard.sh ... If you look at the source of that: wget -O- ...


0

Basically you have to put quotes " around all your HTML tags in your script as they also have a special meaning to the shell. See http://www.tldp.org/LDP/abs/html/io-redirection.html



Top 50 recent answers are included