5
votes
Bash - How to output two commands to file?
I know it's and old post but i needed to output the result of over 10 commands to a file, to work with this file and with @retracile answer i done this (simple & easy):
#!/bin/bash
(
command1
...
3
votes
Accepted
Retrieving Active Directory Users with no Email address from a certain group in powershell
Start from the group and get a members list; get the AD user object for each group member; check whether the user has an email address.
Get-ADGroupMember $yourgroup | Get-ADUser -Properties mail | ...
3
votes
Powershell Script to check free disk space on servers
$volumes = Get-Volume
foreach ($volume in $volumes) {
if ($volume.DriveLetter -notlike "") {$volume.DriveLetter + " has " + $volume.SizeRemaining + " bytes free of " + $...
3
votes
Stumped on why my Startup GPO Script isn't executing BCDEdit correctly
Make sure you have the policy for waiting for the network connection, as my guess is your computer evaluate the cached GPO before even the NIC have finished to initialize, thus fail to run the script.
...
1
vote
Accepted
Fswatch observing folder for new files error from the example doc
do must be preceded by a line break or a ;.
I suggest to remove \ after event.
1
vote
Accepted
how can I detect if g++ compiled without errors
You can check the exit code of execution of g++ like this:
g++ -o bin/program main.cpp
if [ "$?" -eq 0 ]
then bin/program
fi
1
vote
time nohup ./script --> the time hasn't been logged
In your second attempt you measure the execution time of nohup command itself. So to get the build time you should put time after nohup:
nohup time ./mach build >my_log.log 2>&1 &
Also ...
1
vote
systemd not able to run some bash scripts
First, you should set a one-shot service, because your scripts exits when it's done:
[Unit]
Description = Runs the mountup.sh script
[Service]
Type = oneshot
User = adminuseraccount
ExecStart = /usr/...
1
vote
Vmware tags and Ansible , empty out in Ansible but VMs have tags
There could be multiple reasons, make sure you have community installed ansible-galaxy collection install community.general also modify debug to use json_query and you should add a separate query for ...
1
vote
Accepted
NGINX crashed and weird logs on access.log
is this a bot?
Yes.
All public IPv4 addresses on the internet get
scanned by script kiddies all the time.
Stay patched! apt upgrade is your friend.
tried to restart my NGINX a few times
bind() to 0....
1
vote
winget not working unless I do
"if I go to the folder where winget is located ... a "./" infront of it "
instead, just put a "." in front of the whole path to winget.
i don't have winget, but this ...
1
vote
How to monitor scripts executed via cron and perform action on elapsed times?
I've moved most of my cron jobs into systemd timer units. This makes the process of managing them much easier; I don't need to use ps to look up processes to see what to PID to kill.
E.g, instead of:
...
1
vote
Accepted
PowerShell, Active Directory Get-object issue
Get-ADObject, just like all other Get-AD* PowerShell cmdlets, by default only queries Active Directory for a subset of the object attributes. If you want it to query non-default attributes, you need ...
1
vote
Accepted
Linux script , Incremental backup in the same server
You can achieve this with a much simpler script using rsync:
#!/bin/bash
source=/home/ec2-user/source
dest=/home/ec2-user/destination
changed=0
while [[ $changed -eq 0 ]]; do
# The next command ...
1
vote
Bash script to configure IPTABLES
Your equality test is incorrect
if [ $number == "1" ]; then
You need single square braces with spaces around them.
Double square braces do something a bit different.
Also ...
Get into the ...
1
vote
Accepted
Powershell script credentials prompt appears before read-host executes
This appears to be solved by adding an ampersand in front of the script name instead of calling it with powershell like I was doing:
powershell_stuff
..
..
& C:/temp/script2.ps1
..
..
...
1
vote
Windows Equivalent to `sha256sum -c` (cryptographic hash, digest file, recursive integrity check, SHA256SUMS)
I use fsum.
https://www.slavasoft.com/fsum/
Faster, but has problems with different codepages.
Another one is exf
https://www.exactfile.com/exf/
Slower but understands codepages.
1
vote
How can I use openssl to get results from HTTP GET requests?
IBM uses Perl for bootstrapping downloads, and I would recommend using Perl until you can get approval to install curl properly, because it is bundled with the operating system. Specifically, their ...
1
vote
Sort a list of domain names (FQDNs) starting from tld and working left
OK, I'll add one more solution (after 10 years), because the other python solutions did not mention sorted key-function which is readable and easy to understand:
#!/usr/bin/env python
import sys
def ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
scripting × 1820bash × 391
linux × 334
powershell × 274
windows × 256
shell × 126
active-directory × 78
shell-scripting × 65
batch × 63
cron × 58
ssh × 55
windows-server-2003 × 55
automation × 55
ubuntu × 54
windows-server-2008 × 50
command-line-interface × 50
networking × 48
group-policy × 47
batch-file × 44
centos × 41
python × 38
unix × 33
vbscript × 33
email × 31
windows-server-2008-r2 × 30