Questions tagged [scripting]

A form of computer programming that — in the context of system administration — lends it self well to automating tasks.

Filter by
Sorted by
Tagged with
0 votes
0 answers
19 views

Script run from crontab doesn't work [duplicate]

Running on the server I have a command that is started at boot as a service and it works well, now if I run the command that gives me information on the status of the service I get the data view, if I ...
Canuto's user avatar
  • 1
0 votes
1 answer
51 views

Ubuntu/Orange Pi5 retrieve open tabs on Chromium (kiosk mode) via terminal - Powershell

I have a problem as of late where I am developing some PowerShell script to manage and update some digital displays. Please see below for my work in progress (By no means done). I am struggling to be ...
M.Atkinson's user avatar
0 votes
1 answer
127 views

How to run a batch script completely and automatically on event such as sleep/hibernate and shutdown event using task scheduler?

I have written a batch script to perform some folder synchronizing task. I have scheduled the script to execute using task scheduler on events such as sleep/hibernate(kernel power event id 42) and ...
Harsh's user avatar
  • 1
-1 votes
2 answers
370 views

Run commands remotely via SSH with a powershell script natively

We want to run commands on our network devices via SSH from within a powershell script. I know that we can do: ssh [email protected] But this is interactive and requires you to accept ...
Mario Jost's user avatar
0 votes
1 answer
47 views

Custom Script-based Backups

I'm a believer in having multiple restore solutions in place for the environment I support. I have a production backup solution for my Windows Server environment. It includes an agent on each box and ...
Eric's user avatar
  • 1
0 votes
1 answer
81 views

Can't get sub_filter to work in nginx, could it be an ownership/permissions issue?

I have http_sub_module installed, but the 'sub_filter' line is not working. I'm trying to use it for a dynamic nonce for CSP as per these instructions, replacing some text in script tags with the ...
jamminjames's user avatar
0 votes
3 answers
261 views

Shell script capturing values from output of command

From a shell script, I run a ping command: ping -c4 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=58 time=34.2 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=58 ...
Simon Kepp Nielsen 's user avatar
0 votes
0 answers
59 views

not able to send mail with attachment from linux ubuntu : 20.04 by using email mailutils (sendmail keyword)

code : subject="Service resilience service status" body="Service is down" from="[email protected]" to="[email protected]" attachment="/home/ubuntu/...
Nitin Alety's user avatar
1 vote
1 answer
124 views

not able to send mails from linux ubuntu : 20.04 by using email mailutils (sendmail or mail keyword)

code : subject="mail subject" body="Hello World" from="[email protected]" to="[email protected]" echo -e "Subject:${subject}\n${body}" | sendmail -f "...
Nitin Alety's user avatar
0 votes
1 answer
48 views

command took very much longer to run from script than in CLI

In an AWS EC2 serverm, OS: amzn2-ami-kernel-5.10 x86_64 Trying to diagnose an issue of a slow running cron script, identified a single line of command that took more than an hour to run, everyday. ...
Jimmy Chi Kin Chau's user avatar
0 votes
0 answers
212 views

I need to only get all active users in a Security Group, i can list all users but i get both active and inactive users

Need help to correct the scipt. The group FA-xxx-yyy-zzz has loads of users and undergroups in it. This what i figured out so far is: Get-ADGroupMember -Identity "FA-xxx-yyy-zzz" -Recursive |...
Sami Metsokumpu's user avatar
0 votes
0 answers
292 views

Systemd service executing a script with error handling

I have the following issue: I created a systemd service which executes a script. This script contains several commands including psql commands which queries a database and stores the outcome into ...
NeG's user avatar
  • 1
0 votes
1 answer
680 views

Script to cleanup Windows.old remotely

Problem: A lot of older workstations on our networks are running out of hard disk space and I am looking for ways to stream-line the process of cleaning up some space. I understand I can use Disk ...
PedalTech's user avatar
0 votes
1 answer
92 views

Bash script : Print all lines between two pattern in variables with slashes

I have a directory that looks like so : /path/to/files/data-file.1 /path/to/files/data-file.2 /path/to/files/data-file.3 /path/to/files/data-file.4 /path/to/files/data-file.5 /path/to/files/data-file....
Ror's user avatar
  • 323
0 votes
0 answers
106 views

Windows Server - create firewall rules from network trace?

A good basis for firewall rules would be Zero Trust - only allow what is needed. But in many cases, you do not know all the needed rules for a server connection. As a result in many evironments, the ...
David's user avatar
  • 1
1 vote
0 answers
231 views

mikrotik script is not run through GUI or Schedule

I get a problem that i have a one line script as bellow: /tool fetch url="https://......" When i run this script in winbox with "Run Script" button it does not work and after i ...
Salar's user avatar
  • 164
0 votes
1 answer
54 views

Secure method for automated copying of files over a root ssh connection

I currently have a few different services running on my home server and for simplicity, I have a single VM manage the certificates via certbot and just copy them across the network using SCP. The ssh ...
Will's user avatar
  • 101
-1 votes
1 answer
38 views

Extract Pages from Various PDF Files into New PDF File [closed]

From a.pdf, I would like pages 2 and 5 b.pdf, pages 3 and 4 c.pdf, pages 7, 8, and 9 copied into a new PDF file. All input pdf files are ten pages long. I'm using bash, and plan to make many ...
lmat - Reinstate Monica's user avatar
0 votes
1 answer
55 views

Program started with Task Scheduler could not open my Printer

I have a C# program that executes some commands that generates a pdf and print it to a printer. The printer is hosted in a print server, so the way I accessed the printer is through my app config. (\...
Kraust123's user avatar
0 votes
0 answers
91 views

Script to filter nginx logs to automatically running nftables

I have a domain served by nginx. nginx logs have this format: 178.128.120.151 - - [19/Jul/2023:20:27:25 +0200] "GET /favicon.ico HTTP/1.1" 301 162 "-" "Mozilla/5.0 (Windows NT ...
somenxavier's user avatar
-1 votes
1 answer
433 views

Backup of organization's GitHub repository

Is there any guides/best practices/manuals describing how to organize periodical backup (and of course restore if needed) of entire organization's GitHub, preferably with metadata?
Someone Sometime's user avatar
0 votes
0 answers
17 views

Managing ougoing RDP sessions (MSTSC)

I am trying to automate a process where a user can establish an ssh tunnel in WSL then use that tunnel for an RDP connection using MSTSC. The same script might launch multiple instances of MSTSC using ...
symcbean's user avatar
  • 22.3k
0 votes
1 answer
2k views

expect usage in bash script or bash command in expect script

I have a script below that works except for the expect portion: #!/bin/bash # invdir=/home/john/inventory for file in $invdir/$1 do if [ -z $1 ] || [ -z $2 ] then echo "You must enter a ...
JKC's user avatar
  • 31
0 votes
1 answer
220 views

Run custom s6 script in docker container once only

I'm using automation (ansible) to deploy a dockerised app (gitea). The app runs s6 in its docker entrypoint. I want to run my own script: after the container's first load (so the files and db are ...
lonix's user avatar
  • 938
0 votes
1 answer
60 views

time nohup ./script --> the time hasn't been logged [closed]

I need to measure the time that Firefox takes to build itself from the source code. Here's what I do normaly: nohup ./mach build > my_log.log & I then prepended time to it: time nohup ./mach ...
Kentuk's user avatar
  • 1
0 votes
0 answers
215 views

Wireguard-ui: `Bad PATH_INFO : /login`

I've successfully installed Wireguard + UI to a Debian11 VPS with this AIO script. But if I open the http://localhost:5000 via Webmin tunneling, I get this error: Bad PATH_INFO : /login How do I fix ...
SzakiLaci's user avatar
  • 101
0 votes
1 answer
954 views

systemd not able to run some bash scripts

(Update with more info May 16, see end of post for journalctl messages) I've created a systemd timer and service with the purpose of running a handful of bash scripts. In particular I'm aimed at ...
David's user avatar
  • 1
0 votes
2 answers
5k views

How to run a python script in a specific directory automatically?

I have a python script that I wish to run at 5pm every Friday. How can I achieve that ? I understand I could do this through cron. However, as I have used relative file paths in the Python script and ...
LT_Orange's user avatar
1 vote
1 answer
33 views

What is the fastest method of getting a small amount of data from whitelisted servers?

I have a bunch of servers which build various different programs for various different systems. Once a build has completed, it gets archived into a single file and compressed, then an md5sum is ...
Ben Holness's user avatar
0 votes
0 answers
49 views

Script to scan log file

I have a log file with the content below. Let's call it as cpu_usage.out: 2023-04-12 12:04: CPU STATISTICS CRITICAL : USED:- 2.52% IDLE:- 97.49%|CpuUsed=2.52;0;1 CpuIdle=97.49;0;1 2023-04-12 12:05: ...
Diligent Bug's user avatar
0 votes
1 answer
59 views

Is posible to write script that checks for differences between two patterns in configuration files

Linux. I have for example two config files. First: criticalexceptions => [ 'yum-updatesd-helper: error', 'cups: cupsd shutdown succeeded', 'hda: drive_cmd: error', 'end_request: ...
Boniek's user avatar
  • 1
3 votes
2 answers
330 views

Vmware tags and Ansible , empty out in Ansible but VMs have tags

I am trying to filter out the list of VMs with specific tags. The sample playbook is as follows : - hosts: localhost gather_facts: false become: false vars: vcenter_hostname: ...
uozzyy's user avatar
  • 33
0 votes
1 answer
700 views

How to run a script in a OpenVPN server hosted in pfSense when client connects?

I've got an pfSense 2.6 instance which hosts OpenVPN for clients. I'm testing with client version OpenVPN Connect 3.3.7 (2979). There are some web endpoints with a dynamic IP addresses, so I can't ...
Eastman's user avatar
  • 60
0 votes
2 answers
1k views

NGINX crashed and weird logs on access.log

When I came back home just now, I was checking my webserver if it was still running and I noticed that my NGINX server was not running anymore. I tried to restart my NGINX a few times by running the ...
Miksterdam's user avatar
0 votes
1 answer
227 views

How to execute a local script from a local client with Ubuntu on a remote VPS with Ubuntu without prompt?

I have made extensive research about how to setup and secure correctly our new VPS with a Ubuntu 22.04 OS for three weeks, and I have currently a good idea of what has to be done. However, I would ...
Emmanuel FRANCOIS's user avatar
1 vote
1 answer
487 views

Stumped on why my Startup GPO Script isn't executing BCDEdit correctly

Environment: MS Server 2019 DC, Windows 10 Workstations joined to the Domain. The goal here is to set the Data Execution Prevention on a bunch of machines to OptOut. The way to do this via a command ...
The ITea Guy's user avatar
0 votes
1 answer
92 views

Fswatch observing folder for new files error from the example doc

I am trying to "listen in" on changes in a particular folder, then once a file comes in, I want to copy the file to another folder. I figured fswatch would be a great choice for this. And as ...
Remember_me's user avatar
1 vote
1 answer
653 views

SSH config: How to automatically execute an interactive script locally before connection?

Background: I have a local script that needs to execute locally as a pre-requisite to making an ssh connection. The script is already working, but currently users need to run the script, then make an ...
Rino Bino's user avatar
  • 593
-1 votes
2 answers
465 views

how can I detect if g++ compiled without errors

I have a script file to automatically compile a C++ program, then automatically run the executable. script g++ -o bin/program main.cpp bin/program The problem is, sometimes the compiler encounters ...
Ahmad Al-Mutawa's user avatar
1 vote
1 answer
41 views

Scripted Password Change Does Not Survive Reboot Unless One Login Occurs - Debian 11

I am trying to automatically set the root password to random characters via bash script. The script is part of a Vagrant shell provisioner. If the script runs the password change only, I am able to ...
Utkonos's user avatar
  • 426
1 vote
1 answer
96 views

htaccess syntax issue when moving script to a subfolder

I have recently purchased a script but this script only works in public_html folder . I need to install it in a subfolder named shop ( public_html/shop/ ) . Now the following .htaccess rules work ...
Mr Pro's user avatar
  • 33
1 vote
1 answer
646 views

Divide one .pem file containing several certificates to several new .pem files

I am currently trying to figure out how I can divide one .pem file, containing several certificates to several new .pem files, but I do not know where to start... The first .pem file looks like this: -...
mart1234's user avatar
0 votes
1 answer
260 views

Alter Database recovery model & Shrink log, DB dynamically

I normally do on daily basis these operations in GUI Alter database to simple recovery model shrink log file shrink database file Alter database to full recovery model I can understand script but ...
Shadow777's user avatar
0 votes
1 answer
641 views

Trying to start script but keep getting error syntax error near unexpected token `stop'

#!/bin/bash # case “$1” in start) echo -n “Starting Queue Manager” /opt/mqm/bin/strmqm QMPROD1 sleep 10 echo -n “Started Queue Manager” # ...
Boro's user avatar
  • 31
1 vote
1 answer
446 views

Powershell Script to check free disk space on servers

I am in need to check free space on servers but I am getting more than enough details. DeviceID : C: DriveType : 3 ProviderName : FreeSpace : 76691152896 Size : 160482455552 ...
Newb_969's user avatar
2 votes
0 answers
36 views

Disable computer on a schedule

I'm looking for a way to disable end user access to a Windows 10 workstation during a given period, say, from 8pm to 8am. It doesn't need to be superuser-proof. It doesn't need to be reboot-proof. ...
entonio's user avatar
  • 185
0 votes
0 answers
69 views

Need help to Split the below HTML text file in two parts using linux scripting

I have a html main.txt file, I need help to split it in two parts. headpart.txt and bodypart.txt. Below is my html main.txt text file - Original <p class=\"auto-cursor-target\"><br /...
Goural's user avatar
  • 35
1 vote
2 answers
1k views

winget not working unless I do

When I open Powershell, and type winget - this is the response: winget : The term 'winget' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of ...
Thomas DeColita's user avatar
1 vote
1 answer
928 views

How to monitor scripts executed via cron and perform action on elapsed times?

I run numerous scripts via CRON throughout the day, and as they rely on third-party providers which sometimes are slow, I currently run them like so timeout 60m bash /script.sh and that's worked great ...
alturic's user avatar
  • 11
0 votes
2 answers
4k views

Check Windows registry to see if host is joined to an Azure AD domain?

On a Windows PC joined to a 'traditional' Active Directory domain, querying Win32_ComputerSystem or Win32_NTDomain returns the domain name. On Azure anything [joined], those classes return nothing. ...
SKidd's user avatar
  • 61

1
2 3 4 5
37