Questions tagged as ['scripting']
I have to restore a backup from a Linux MariaDB to a Windows MariaDB, where the PowerBI gateway will import its data. "mariabackup" is MariaDB's physical backup tool. But to restore it, the destination folder (%programfiles%\MariaDB 10.3\data\
) must be empty.
Since rmdir /S /Q "%programfiles%\MariaDB 10.3\data\
will remove the "data" directory (what I don't want!!!), I have been working to avoid this ...

I using this curl request for sending data to API :
curl --location --request POST 'MY_IP' \
--header 'Content-Type: text/plain' \
--data-raw ' [{
"event_id": "123",
}]
'
I want to check the API performance by sending request asynchronously and measure the time take I tried to use xargs -P 10
which say send 10 request parallel but not able to do so ? Any help and how I can measure time ?

I simply want to add a comment (specifically, add the host name) to the simple queues created by the DHCP rate limit option.
However, while scripting, when I tried the command
/queue simple set dhcp-ds<XX:XX:XX:XX:XX:XX> comment="hello"
I was met with the error
failure: cannot change dynamic
Is there another way?
I have many shell and python scripts on my crontab that ending either with:
command.sh > /dev/null 2>&1
or
command.sh 2>&1 >/dev/null
I know that:
>
is for redirect
/dev/null
is a black hole where any data sent, will be discarded
2
is the file descriptor for Standard Error
>
is for redirect
&
is the symbol for file descriptor (without it, the following 1 would be c ...

My users tend to save tons of duplicate files what consumes more and more space and generate HW and archiving cost.
Im thinking to create some scheduled job, to:
- find duplicate files (check file MD5 sum, not only filename / size)
- leave only 1 original file
- replace other redundant copies by link (shortcut) to file (point above)
Any idea how to archive that?
Script / tool / tips ?
EDIT 28.10.2021
So I have a python script that I compile with pyinstaller
to a single file. at the time of running, by default, the script will unbundle the modules in /tmp/
also you can change the default TMPDIR at the time of compilation.
PROBLEM:
As you might know, this is a common security practice that you mount /tmp/
or /var/tmp/
as a noexec
. the problem is that my script can't execute the modules from /tmp ...

To summarize:
I want to run multiple servers on a host, for different groups of users, and allow them to add and modify functionality of the servers at runtime with some form of scripting. This is a 100% necessary feature for what I want to do, but there is obviously a lot of potential for this to go horribly wrong; what are some actions/approaches I can take to mitigate the risks involved?
It's pr ...

I am working on a service + webapp + mobile app combo where
- the mobile app is used to consume content
- created by an open community of authors on the web app
- with the whole being serviced by a server running Nginx on Ubuntu (well some requests are proxied off to backend Nginx servers) but that is a detail
The issue that I want to deal with efficiently is the one arising from the fact that the conten ...

How can I copy all .msg files that are spread throughout some GUID sub-folders in one folder to another folder that has a slightly different folder name at the end. Is it possible?
So for example:
- Source
- c:\Folder A\16-1167 Contoso 1 Hacker Way\Correspondence
- c:\Folder A\16-1168 Company name, address\Correspondence
- Destination:
- C:\Folder B\16-1167\0ba45cbd-6da8-4a4c-ae1c-9aca13aab1db\1\filename.m ...
def NAMESPACE = "Dev"
def BODY= sh(
script:'''body=$(cat <<-EOF
{
"name": "${NAMESPACE}",
"type": "regularwebapp"
}
EOF
)
(echo $body)''',
returnStdout: true
).trim()
The above doesnt work, output is as follows:
{
"name": "",
"type": "regularwebapp"
}
How do I get the absolute path to a given binary and store it to a variable?
What is the equivalent to the following for Linux Bash in Windows Powershell?
user@disp985:~$ path=`which gpg`
user@disp985:~$ echo $path
/usr/bin/gpg
user@disp985:~$
user@disp985:~$ $path
gpg: keybox '/home/user/.gnupg/pubring.kbx' created
gpg: WARNING: no command supplied. Trying to guess what you mean ...
gpg: Go ahead ...
am trying to run script in background which contain command such like "asterisk -rvd >> xyz.log", when I run it directly it work well but when run it with any background way (service, cron, &, nohub,,) it stop directly with this message: stopped
so what is the prober way to run this command at background ?
I would like to push "Never saved" websites to users' Chromium Edge settings. The goal is to disable password saving for these particular websites/domains.
The method doesn't matter, only the end result. In this way, solutions that use Group Policy, registry change, script, etc. are all okay if they work. (Of course, adding the settings manually is no good).
NOTE: I have searched the Group Policy se ...
I want to generate an alert in Monitoring and Login and I want that when that alert is triggered, my script is executed (which I already have generated in my cloud repository), how could I do it?

So I have all the once_logged_in profiles listed in C:\Users folder but I need to find out when was the last time these users logged in onto the same computer locally or remotely with their domain user credentials. Is their any easy way to reach this goal? I mean scripts in PS or batch commands, wmi, anything. Unfortunately event log auditing is not on.
how to do so that in this script which searches for something from the database. he searched for it and changed its name in the terminal. I have a problem with the quotes here. Maybe anyone know how to fix it?
spr-ustawien()
{
echo -e "\e[31;43mSprawdzanie Ustawień\e[0m \e[101mIP $1\e[0m"
intertube=0
while [ $intertube -ne 1 ]; do
ping $1 -c 5
if [ $? -eq 0 ]; then
sshpass -p (pass) ssh -t (user)@ ...

I'm trying to create a script and schedule it on exchange in order to have a daily report for users which are sending more than a defined numer of email outside organization within 24h.
I found this similar script but it is not the same scenario as the one i'm trying. Also i'm using Exchange 2016:
add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010
$output = Get-TransportServer | Get-Message ...
Hi I'm doing some scripting to add a task on a Task Scheduler. However I need to have a script to select the "run with highest privileges".
Sample code:
Dim settings
Set settings = taskDefinition.Settings
settings.Enabled = True
settings.StartWhenAvailable = True
settings.Hidden = False
I need to write a script so that my colleagues and myself can restart different services on multiple servers. We all connect to the servers with LDAP so i'd like my script to connect our LDAP users to the server and then use sudo to restart the services (I can write a script on each server to restart all the services needed). Right now the script simply run a command like
ssh -t user@host "sudo ser ...
I am currently trying do change up a script so that I can put it into a GPO. The Script itself works but I want to do a "if else" around it.
The Script is found here: https://gist.github.com/exchange12rocks/950aa29f66e6369d2c02fa8583bb3a75
The goal was to check if a registry key exists and if not, create it and set it to 1. So that way the Script only ever runs once.
I did the if else like this:
I have a script that is giving me an output like this:
ruby-devel is needed by software1
tcl is needed by software 2
python3 is needed by software 3
ocaml is needed by software 1
I'm new to awk but was trying to script it to get the first word, and put it in a single line (can use sed or the best way to actually do this, I couldn't do it) to be able to build an output like this:
You need to get: ru ...

I have seen many posts on this website about something similar but none of them have had the resources to fix my issue so I will go into as much detail as I can. If I leave any information out let me know.
We have a server with an exe file on it to start an update for a software called Bluebeam. I wrote a script file to start that exe on startup and placed it in the same directory as the exe. Not ...

is there a way to capture the Windows firewall traffic (TCP/UDP, Ports, IPs) for some time and then convert them to allowed firewall rules on Windows systems?
It would make sense in my opinion to capture the traffic for like a week while "allow" both incoming and outgoing. Then let the main programs use their ports and capture the traffic into the Firewall log. Then create allow rules from the lo ...