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 ...
Blockchain Office's user avatar
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 | ...
Massimo's user avatar
  • 69.8k
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 " + $...
batistuta09's user avatar
  • 8,936
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. ...
yagmoth555's user avatar
  • 16.7k
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.
Cyrus's user avatar
  • 925
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
Romeo Ninov's user avatar
  • 4,442
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 ...
Romeo Ninov's user avatar
  • 4,442
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/...
Halfgaar's user avatar
  • 8,074
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 ...
Saxtheowl's user avatar
  • 1,002
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....
J_H's user avatar
  • 146
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 ...
curtmcgirt's user avatar
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: ...
larsks's user avatar
  • 43.2k
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 ...
Massimo's user avatar
  • 69.8k
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 ...
Vinicius's user avatar
  • 168
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 ...
Phill  W.'s user avatar
  • 1,469
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 .. .. ...
rumplesmyboy's user avatar
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.
Andre's user avatar
  • 11
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 ...
Scott Centoni's user avatar
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 ...
Gregor's user avatar
  • 541

Only top scored, non community-wiki answers of a minimum length are eligible