Skip to main content

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
10 views

PowerCLI script to get Alarms generated on my vCenter in past 12 hours?

How can i get the list of all the alarms triggers on my vCenter in the past 12 hours and categories these based on severity? is any powerCLI script available for that?
Gemma Paterson's user avatar
0 votes
1 answer
75 views

Using destination file name vs destination directory when moving a file creates auditd logging dilemma

I am trying to log file operations using auditd (audit 4.0.1) and came across an issue with moving files. If I include the filename in the destination: mv /mnt/user/home/file.txt /mnt/user/home/...
user2328273's user avatar
0 votes
1 answer
39 views

.htaccess exposed to www since upgrade from apache 2.2 to 2.4

I just upgraded apache on my very old WHM server from 2.2 to 2.4, and now .htaccess files are being treated like text files instead of apache scripts. I also installed mod_ruid2 0.98 These three lines ...
mike_s's user avatar
  • 1
0 votes
0 answers
53 views

Need help to configure autoshutdown with Vertiv power-assist via script

I have a Proxmox cluster which is protected by a Vertiv UPS. I am using Vertiv Power Assist to monitor the UPS via SNMP card. The software offers the possibility to execute a script before shutdown in ...
Wodel's user avatar
  • 81
1 vote
0 answers
183 views

Set service Startup Type to "Automatic (DelayedStart)" with PowerShell

I'm trying to script changing specific services to have Startup Type "Automatic (DelayedStart)". When I pipe the services into Set-CimInstance, I get an error that it "could not modify ...
Alex Pixley's user avatar
0 votes
1 answer
83 views

Query Windows RDP monitor positions via command line

I am using Windows RDP (remote desktop) with a multi-monitor setup and I want my script to automatically detect the position of the monitors. Additionally, I only use some of my monitors for RPD with ...
Aaron Caba's user avatar
0 votes
0 answers
80 views

Stop minikube on Ubuntu shutdown

I'm new to Kubernetes, I have internal instruction on how to setup the app locally using minikube. The problem is that I sometimes forget to stop the Cluster, if I do when shutdown the system it will ...
jcubic's user avatar
  • 250
0 votes
1 answer
56 views

script to print dhcpd.leases info to syslog/file

So i'm running dhcpd on a server and to my knowledge the logs from dhcpd are not adjustable, if they are i'm dying to know how... Anyways, i need something to check the dhcpd.leases-file which is ...
Tomsch112's user avatar
0 votes
0 answers
54 views

I would like to batch (with a command line) the "reparation" of LibreOffice (odt mainly) corrupted files

I have received a quite large collection of LibreOffice odt files, which are corrupted (for a reason still unknown). When opening most of them, LibreOffice proposes to repair/fix them, and it looks ...
Covot's user avatar
  • 1
0 votes
1 answer
261 views

Creating a computer account in AD using PowerShell

I want to create a new computer object in an AD domain. Below is the script I am using. Can someone tell where should create credential object for SRV1? In domain controller or in computer? If ...
munishhh's user avatar
0 votes
0 answers
21 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
66 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
388 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
5k 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
60 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
502 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
843 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
91 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
193 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
80 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
391 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
501 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
2k 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
2 answers
215 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
  • 353
0 votes
0 answers
152 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
334 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
  • 174
0 votes
1 answer
62 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
  • 111
-1 votes
1 answer
50 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
89 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
101 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
741 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
1 answer
3k 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
290 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
  • 1,019
0 votes
1 answer
62 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
1 answer
2k 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
9k 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
  • 1,016
0 votes
0 answers
51 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
66 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
575 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
923 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
1 vote
2 answers
3k 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
283 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
757 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
117 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
891 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
  • 652
-1 votes
2 answers
596 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
48 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
  • 408
1 vote
1 answer
114 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
926 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

1
2 3 4 5
37