Questions tagged [scripting]

A script is a sequence of commands or instructions that are executed by an interpreter program rather than compiled into a standalone executable program.

5
votes
0answers
224 views

programmatically alter kde file associations

Problem: In kde I want to remove a particular file association from every file type Details: I wanted to try out clamTk as a companion to clamAv. It didn't suit my needs so I uninstalled the ...
3
votes
0answers
298 views

How to rsync files when a USB stick is mounted

Tried a little project to aid in transferring control files from my home computer to my work shop computer. The outcome confuses me. What am I doing wrong? The home computer is running Fusion 360 ...
3
votes
0answers
126 views

How to dynamically control the audio volume based on current decibels

Since the Internet videos have different sound volume levels I am wondering is there a way to dynamically decrease the audio volume if it's above certain decibels to a normal value. Could someone ...
3
votes
0answers
126 views

Automatically restarting process in the X server

I would like to know how to have a process that starts with the X server and automatically restarts when it stops running. I am running Ubuntu 14.04 with a KDE 4.13.3 desktop. I am running the ...
3
votes
0answers
80 views

End recording once silence is detected

I've been using something like this up to now: End sox recording once silence is detected But now I'd like for the audio source and recording mechanism to be separate. I can get the source as an ....
3
votes
0answers
60 views

Notifying program that X session is shutting down

Ok. I understand X session is a bit vague here so let me clarify what I mean by the phrase. I mean the situation where a person has been presented with a display manger screen ( eg xdm, kdm, gdm, mdm, ...
3
votes
0answers
939 views

gnome-terminal cmd leaving processes open after closing parent window

The following simple command should demonstrate my issue: gnome-terminal --tab -t "Tab 1" -e "/bin/bash" --tab -t "Tab 2" -e "/bin/bash" This should open a new window with two tabs and an active ...
3
votes
0answers
419 views

Using tcpdump to log blacklisted IPs

I am using tcpdump to log traffic outbound on a network. I would like to be able to log traffic on a host or IP-only basis but then I would like to be able to log large numbers of potentially ...
3
votes
0answers
1k views

Cron file syntax checker/validator script

Does anyone know a script (bash, perl, php ...) to validate the syntax of crontab files? I found this http://www.intuitive.com/wicked/showscript.cgi?053-verifycron.sh but just Vixie cron notation is ...
2
votes
0answers
51 views

Copying contents of a folder via SCP results in `scp: error: unexpected filename: .`

I was using a script to copy the contents of a folder via SCP, without copying the folder itself. Something like this: scp -i id_rsa -P "$PORT" -r "$HOST:/folder1/folder2/." "backup" (I'm not able ...
2
votes
0answers
44 views

Using killall with -u and -o options

I wanted to confirm some details with the killall -o option. I tested it on some ssh connections I created under the user rick. First I printed a list of all of ricks ssh connections along with the ...
2
votes
0answers
141 views

how to output html to a file with xmllint?

How do I get xmllint to output to a file? thufir@dur:~/xmllint$ thufir@dur:~/xmllint$ xmllint --html http://www.skynet.be/nieuws-sport/weer/mijn-weer?cityId=6450 --xpath '//div[@class = "tides"]' - ...
2
votes
0answers
38 views

Get the path of song playing in VLC using python script

I am trying to get the path of song playing in VLC using python script. I have already find out the Process ID of vlc using pgrep -x vlc And I can also display the all file descriptors of vlc ...
2
votes
0answers
50 views

script-like pty recording

dear unix wizards: I have wrestled with the unix script program for a while, but to no avail. It may be the wrong program altogether, but googling is hard, because script usually just means sh or ...
2
votes
0answers
43 views

Prompt user with email when Disk Usage is over 200GB

find . -printf "%u %s\n" | awk '{user[$1]+=$2}; END{ for( i in user) print i " " user[i]}' Hi I have been using the above CMDline to look for each user's disk usage information. I would like to know ...
2
votes
0answers
107 views

Flicker-free OSD display of system information

I'm trying to get a small script running to display information about CPU and GPU usage. The script is complete and outputs information in the following format CPU 2% 37C GPU 0% 56C ...
2
votes
0answers
352 views

Automating Google image search

I am using a raspberry Pi at the moment and I would like to acheive the following. Every hour an automated Google Image search of a specific predefined term. The image is then downloaded to the Pi ...
2
votes
0answers
105 views

AppleScript dialog and repeated `say' command not working in OS X cronjob

I've got a script in OS X that looks in a given directory for the file with the most recent mtime, sees if it's (past) a certain size, and, if so, creates an AppleScript dialog box + repeats an ...
2
votes
0answers
825 views

Converting script from init to systemd

I am moving from Ubuntu 11 to 16, and would like to convert custom-made scripts to work with Ubuntu 16 I have started and completed First init script but need a bit of help on Second init script. I ...
2
votes
0answers
445 views

Integration of `afuse` with `sshfs` as a (systemd?) user-daemon spawned from login or first shell

To facilitate working with remote files, I setup afuse with sshfs to run from my .bashrc. It works, after bash init all my remote trees from ~/.ssh/config/ are mounted on-demand under ~/scp/, but ...
2
votes
0answers
271 views

Change existing dovecot maildir installation from m-UTF7 charset to UTF8 to avoid breaking TAB

In an existing dovecot installation with many pre-existing folders using regional characters I would like to change m-UTF7 (.&AMk-l&AOk-ments envoy&AOk-s) foldernames to UTF8 (.Éléments ...
2
votes
0answers
429 views

killall doesn't work if I call it from a script

I'm starting a tcpdump inside a script and I also kill it from the same script. So I'm currently using the killall command for this: The script gets executed from an udev rule: This is the section, ...
2
votes
0answers
648 views

Slow script execution

I have a strange problem... My script: #!/bin/bash SECONDS=0 lock_file=/tmp/$0.lock [ -e $lock_file ] && exit touch $lock_file echo "<<<db2_hadr_check>>>" instances=( ...
2
votes
0answers
415 views

How to disable AC power supply from CLI

This article among others suggested the following to prolong battery life: Keep cool. Operate in mid SoC of 20–80%. Prevent ultra-fast charging and high loads (most Li-ion) The main issue here is ...
2
votes
0answers
282 views

“Restart” a process in the same terminal?

I put "restart" in quotes because the following question on SO illustrates what I'm trying to do: https://stackoverflow.com/questions/27957091/restarting-a-process-in-the-same-linux-terminal I'm ...
2
votes
0answers
129 views

Restore Trash Script not working

I made a script to send a file to a trash folder... echo "Are you sure you want to move this file to the Recycle Bin?" "(Yes/No)" read ans case "$ans" in Yes) echo "$(readlink -f "$1")" >> "$...
2
votes
0answers
81 views

Automating startup tasks

I have a "morning ritual" that occurs on every boot of my machine: starting up a few browser tabs, starting up skype, starting up terminator and subdividing some screens, etc. Is there any tool that ...
1
vote
0answers
10 views

systemd service start after network online and time synced

I made a system service for a python script, I want it starts on boot after the server is online and the time is synced correctly. What do I have to add in .service file? I tried in [Unit] with ...
1
vote
0answers
50 views

Setup Automation - Firefox and Addons

I am improving my setup script for new installs and want it to include setting up firefox. One big problem I found is, that it is not possible to install addons via CLI that automatically get updated ...
1
vote
0answers
117 views

How to get the average CPU usage over the past 10 seconds in bash?

I need a command that would echo the average CPU usage over the past 10 seconds in Ubuntu 18. Each of the following conditions must be met: It must be lightweight with a very small footprint, ...
1
vote
0answers
178 views

Evaluate the similarity between two video files

I'm looking for a method that reliably gives me a "mathematical distance" of two videos from one another. Similar to how the Levenshtein distance can be used to get the distance from a string to ...
1
vote
0answers
171 views

systemctl doesn't work from crontab

I'm trying to run a script calling systemctl from crontab but the command is not being executed. Other scripts work fine from crontab. The script works when executed in a terminal. This is the script:...
1
vote
0answers
208 views

How to script AT command to modem?

Every time my USB modem (/dev/dlinkModem) gets unplugged it defaults to "radio disabled mode" (AT+CFUN:4). I can easily enough call AT+CFUN:1 through the minicom application console to enable radio ...
1
vote
0answers
34 views

Adding a tag to variables in script that creates config file

What is the easiest way to add a tag? For example, in my script that creates a config file, I have the line echo "Variable = ${arr[0]}" >> $CFG_FILE So, this takes the respective entry from ...
1
vote
0answers
153 views

automated tool (or script) for cleaning systemd journal of corrupted files?

It is my understanding that the systemd journal cannot repair or fix errors revealed by: journalctl --verify Here's an example of an error I just saw. I routinely see errors like this on all the ...
1
vote
0answers
472 views

Automation of ssh change password on 1-st login (no expect)

My account was copied from 1 to a big number of hosts. On every host on 1-st login I get: WARNING: Your password has expired. You must change your password now and login again! Changing password for ...
1
vote
0answers
125 views

How to overcome HiDPI problem with Qt-based apps in Gnome environment?

I seem to have an HiDPI issue with Qt apps only, displaying extra large menus and toolbars when system dpi setting is 100+ The easiest solution for this I guess would be forcing a fixed dpi setting ...
1
vote
0answers
747 views

Automatic Login with cURL without php

I'm working in a little project using a script to do scraping. I'm trying login in https://www.plusdede.com/login, it's a simple login with a numeric captcha. The code which is important is: <div ...
1
vote
0answers
603 views

How to speed up awk script that uses several large gzip files?

I have two data files: file_1.in, containing over 2k lines like "12 AB0001": 10 AB0001 11 AC0002 12 AD0003 ... A list of *.gz gzipped files (about 1 to 3 million lines) I should extract and parse ...
1
vote
0answers
271 views

Linux - Ubuntu - GUI - Remote Mouse and Keyboard from 1 master to 10 slaves

Is it possible to replicate mouse and keyboard actions to multiple devices? e.g. listen on ubuntu 1, then replicate the exact mouse and keyboard actions to ubuntu 2, ubuntu 3, ubuntu 4 and so on. I ...
1
vote
0answers
29 views

Opening applications in a different desktop from a command line

Is there a bash command which can open a particular application in a different desktop (virtual desktops) in KDE Plasma 5.8.7? I'm trying to make a script file which when I run will make my entire ...
1
vote
0answers
93 views

Run multiple screens and attach them for a split view

So I'm new to screen and I've been using this .screenrc for now - https://gitlab.com/joaopizani/env.screenrc-ftw. I'm trying to make a script that, given a target host, will do the following: Open a ...
1
vote
0answers
133 views

Script to rename workspace

I'm using Linux Mint Mate and I want to have a script to do set-workspace-name 0 "Workspace 1" How would it be? I tried this but it doesn't work since there is no ~/.workspacenames/names directory. ...
1
vote
0answers
29 views

Read input with startup script Finnix 110

I am in the process of setting up a liveUSB that will run some scripts on a machine when it is booted. The main OS on the USB is finnix 110, and I am setting up startup scripts in the /indep/rc ...
1
vote
0answers
134 views

How to automate downloading recent file uploaded in Google Drive folder?

I want to automate the downloading of files that are daily uploaded to a shared Google Drive folder.
1
vote
0answers
539 views

`Unhandled Exception: System.ArgumentNullException: Value cannot be null.` error while running `dotnet run` using a startup script

I'm trying to run a dotnet app using dotnet run --configuration Release at system server Startup/Reboot. I'm using a init.d script to acheive the same. My startup script, located at /etc/init.d/...
1
vote
0answers
1k views

Ansible, trying to find a way to force a task time out on a host it's currently operating on

Concerning Ansible, this should be fairly straightforwards I hope: Scenario: I have 3 servers, red, green, and blue. I have a task created for ansible to use yum in linux to install a random ...
1
vote
0answers
74 views

Setting up working environment - Konsole or other terminal - open few tabs and run some commands

I have a working environment where I run a web server, TSC compiler, and then work in few directories in a console, and also run few programs - IDE, 2x gitk, krusader. I would like to be able to ...
1
vote
0answers
60 views

Identify (and delete) all .gif files with more than 1 frame in all subdirectories

I having the following linux command to identify all .gif files and list its frames in the active directory: identify -format '%n %i\n' -- *.gif Now I want to modify and expand the command to ...
1
vote
0answers
400 views

Debian/Raspberry usb webcam test before issuing fswebcam script, multiple fails will crash OS

I was able to configure raspberry Pi as wifi_router/firewall/gammu/weewex/ups/webcam weather server. The problem which I'm not able to solve is incompatibility issue between linux and Microsoft ...