I tried to capture using the below command in WSL Ubuntu.
moauris#AUR00101:~$ /pp/nmon/nmon -s 60 -c 1440 -f -m /mnt/c/Perf_data/
It was supposed to run as a process until 1440 captures, but it did not. It ran and immediately end.
Please guide me to the correct way to capture nmon, or it cannot be done in WSL? Thanks!
Related
I am launching a locally installed executable automated gui program that uses pyautogui on ansible hosts running windows. I use the ansible powershell module (ansible.windows.win_powershell) to run the following command on all of my hosts: psexec -i 1 -d my_prog.exe when I run this command it runs most of the way through but when it requires pyautogui, it simply stops without even throwing an error. If I add -s so I'm now calling this: psexec -i 1 -s -d my_prog.exe it almost works, except launching the exe as admin (which is what adding the -s does) makes it so my program no longer recognizes the microphone, which it did before, and I need the microphone for my program to run properly. Psexec is necessary as I have found no other way to launch GUI apps on windows machines over ansible. My biggest concern is that I am unable to see the microphone when running the script as admin, because when not in admin mode, the program does in fact recognize the microphone.
The question pretty much says it all. I basically want to create a driver that is compatible with my current MacOS (Catalina). The issue I'm facing is that my printer (with scanner) currently will only scan pages and print them out. I'd like to be able to use my scanner to save an image of a scanned document.
I'm honestly not sure if writing a driver is the best way to do this but the manufacturer (Canon) no longer has drivers for this old scanner. But it works just as well as the day we got it so I REALLY don't want to have to toss this one out and buy a new one.
UPDATE: currently stuck with the following:
rabdelazin#rabdelazim Downloads % device=$(sane-find-scanner | awk '/Canon/{print $NF}')
rabdelazin#rabdelazim Downloads % echo $device
libusb:020:029
rabdelazin#rabdelazim Downloads % scanimage --device Canon:$device -x 210 -y 297 --mode color --resolution 240 --format=tiff --depth 8 > ~/Downloads/scan.tiff
scanimage: open of device Canon:libusb:020:029 failed: Operation not supported
I have an EPSON Perfection 4990 Photo on macOS, so I cannot give you full code and examples for your Canon but it may get you started. I spend my life in Terminal rather than using GUIs for anything so I just scan the full area of the platten at full resolution and do whatever I need later with ImageMagick or Photoshop if necessary.
So, to get it going I installed homebrew from here. Then I installed some packages:
brew install libusb
brew install sane-backends
Then I can find my scanner with:
sane-find-scanner
Sample Output
found USB scanner (vendor=0x04b8 [EPSON], product=0x012a [EPSON Scanner]) at libusb:003:002
Now you need the last word on that line, the libusb:003:002 part, with my EPSON, I use:
sane-find-scanner | awk '/EPSON/{print $NF}'
You will need to see what you get, and adapt slightly.
SampleOutput
libusb:003:002
So, in order to scan, I capture that in a bash variable called device and do this:
device=$(sane-find-scanner | awk '/EPSON/{print $NF}')
scanimage --device epson:$device -x 210 -y 297 --mode color --resolution 240 --format=tiff --depth 8 > ~/Desktop/scan.tif
I put the whole lot in a bash script called scan like this:
#/bin/bash
TMP="$HOME/Desktop/scan.tif"
# Find libusb device name
device=$(sane-find-scanner | awk '/EPSON|HP/{print $NF}')
if [ -z $device ]; then
echo ERROR: Unable to find libusb device
exit 1
fi
echo Found scanner at: $device
# Now scan full-size, colour, hi res
scanimage --device epson:$device -x 210 -y 297 --mode color --resolution 240 --format=tiff --depth 8 > "$TMP"
# Check we got a file
if [ ! -s "$TMP" ]; then
echo ERROR: Empty scan
exit 1
fi
My script has some further, optional, ImageMagick stuff at the end to create a Web-usable JPEG, if you add this you will need to do:
brew install imagemagick
Then add this to the script above:
# Copy the file to User's Desktop and number nicely...
# ... save as hi-res 16-bit TIF
# ... and medium res, medium quality JPG for web use
cd ~/Desktop
i=0
while :; do
base=$(printf "scan-%03d" $i)
if [ ! -f "${base}.jpg" ]; then
cp "$TMP" "${base}.tif"
convert "$TMP" -resize 2000x2000 -quality 85% "${base}.jpg"
break
fi
((i++))
done
Here are a couple of resources I found helpful when working it all out. You can debug the scanimage program with:
SANE_DEBUG_SNAPSCAN=128 scanimage -L
This resource was useful.
You can get help like this:
scanimage --help -d epson
Note that you may also be able to use a Raspberry Pi or similar small, low-cost Linux machine as a "scanner server". Basically you would attach your scanner via USB to the Raspberry Pi and run SANE on the Raspberry Pi. Once you get it working, you could run saned which is a daemon service, on the Raspberry Pi, that listens on the network for other devices (such as your Mac) making requests to scan. It does the scan, using its Linux SANE drivers and delivers the image back over the Ethernet to the Mac (or other) client. I know you dislike this option, but there may be future readers...
Keywords: macOS, OSX, scan, scanner, scanning, EPSON, Canon, HP, libusb, SANE, sane-backends
Well after a LOT of trial and error, I've finally come up with a solution.
TL;DR: I made a print server out of a raspberry-pi and installed cups and set the printer to be shared through the server. Works like a charm!
It took quite a bit of investigation but as part of reviving an old laptop, I got it running by installing Ubuntu 20.04. Just for kicks I decided to try and print something from the laptop. I had to install CUPS and maybe a few other packages but it worked. That got me thinking that I should just make a print server that knows how to talk to the printer so all the other machines can come and go but my printer should still work.
I am trying to create a Shellscript with the following commands.
#!/bin/bash
ipa-client-install --uninstall
/usr/local/sbin/new-clone.sh -i aws -s aws-dev
My problem is that the ipa-client-install --uninstall command prompts for a reboot at the end with the default value being no.
Here is the output.
Client uninstall complete. The original nsswitch.conf configuration
has been restored. You may need to restart services or reboot the
machine. Do you want to reboot the machine? [no]:
How can I supress the reboot dialog and just accept the default "no"?
How can I check to see if ipa-client-install is installed before attempting to remove it?
I am new to Shellscripting, so I am struggling a bit :-)
Please be safe.
You can use Linux pipes to take care of the prompt issue. To rpm -q will help you to check if the package is available.
Your final script would be like
#!/bin/bash
if rpm -q ip-client-install
then
echo no | ipa-client-install --uninstall
else
echo "Package not found"
fi
/usr/local/sbin/new-clone.sh -i aws -s aws-dev
I'm trying to run snort in windows, but instead of using -i eth0, can i use remote (rpcap). I'm using windows 7 in vmware
Here is the command i run
c:\Snort\bin>snort -c c:\Snort\etc\snort.conf -l c:\Snort\log --daq pcap --daq-mode inline -i rpcap://[xx.xxx.xxx.xx]:2002/\Device\NPF_{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx}
I run on ERROR:pcap does not support inline
run command snort --daq-list; the result is
Available DAQ modules:
pcap(v3): readback live multi unpriv
Please help, how can i connect and collect data to my remote machine.
Many thanks!
Your problem is that you are trying to operate in inline mode and read a pcap, which doesn't make sense. You would do one or the other. Notes:
The argument "--daq pcap" isn't required for you because pcap is the default, but this won't cause any problems, just a note.
The argument "--daq-mode inline" should be completely removed from the command. You are playing a pcap so the device isn't inspecting traffic inline, it doesn't make any sense to use this here.
Using the -i option is for specifying the interface to listen on. You don't want to specify a pcap file here. Since you are replaying a pcap you need to change this argument to "-r". snort help for this option: -r <tf> Read and process tcpdump file <tf>
Your command should be as follows:
c:\Snort\bin>snort -c c:\Snort\etc\snort.conf -l c:\Snort\log -r rpcap://[xx.xxx.xxx.xx]:2002/\Device\NPF_{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx}
Is there a way to -- from the terminal -- query for the latest toolkit/SDK version???
e.g. Does NVIDIA have some sort of server that one can log in and issue a discrete command to get the latest SDK and toolkit??
...................................................................................
Background:
I wrote a small script to perform an unattended install of the core CUDA components -- dev drivers, toolkit, and SDK.
Note the drivers already have an automated updated, in that I pass them a flag that tells them to check for the latest version, so I only need to download once and all future updates to the CUDA install will now work
Had some initial errors, but worked it out with a bit of help. [1][2].
The init is to take down the X11 server if one is running, in order to complete the video dev driver install. The yum is to install expect if it's not present.
#!/bin/bash
CR="\r"
YES="\"Yes\r\""
INSTALL_PATH_REQUEST="\"Enter install path\""
CUDA_PATH_REQUEST="\"Enter CUDA install path\""
UNINSTALL_REQUEST="\"Would you like to uninstall?\""
TOOLKIT=`ls -t cudatoolkit* | head -n 1`
TOOLKIT_EXPECT="sh $TOOLKIT"
SDK=`ls -t gpucomputingsdk* | head -n 1`
SDK_INSTALL_PATH="\"/usr/local/CUDA_SDK\r\""
SDK_EXPECT="sh $SDK"
DUMMY="dummy"
/bin/su root -c "yum -q -y install expect expectk;
/sbin/init 3; sh `ls -t NVIDIA*|head -n 1` -s --update -a -X;
/usr/bin/expect <<EOF;
spawn $TOOLKIT_EXPECT
expect -timeout 300 $INSTALL_PATH_REQUEST
send $CR
expect -timeout 300 {
{Would you like to uninstall?} {
send $YES
exp_continue
}
expect -timeout 500 $DUMMY
eof
}
EOF
/usr/bin/expect <<EOF;
spawn $SDK_EXPECT
expect -timeout 300 $INSTALL_PATH_REQUEST
send $SDK_INSTALL_PATH
expect -timeout 300 $CUDA_PATH_REQUEST
send $CR
expect -timeout 500 $DUMMY
EOF
/sbin/init 5"
If someone can figure out how to query the SDK and toolkit remotely for updates, this would be the (almost) perfect unattended installer. Any other advice would also be appreciated if you think I'm missing anything.
P.S. You need the dev driver, toolkit, and SDK files in the same directory for this to work. When it asks you for the password, that's asking for your root password. I choose to install the SDK in /usr/local/CUDA_SDK/ to allow all users access. If you wish to install it in another location, change it in the script.
I don't believe NVIDIA provides a way to query the latest released version of driver, toolkit, SDK, etc. On the windows driver there is now an auto-update feature, and the linux driver may have one too (not sure), but I don't think we have a way to query the current release version.
There are always various driver versions out for different platforms and technologies (like prerelease developer drivers for Tesla, WHQL drivers for windows, etc).
I think most cluster operators would only want to upgrade to stable releases of any software, and that only happens a few times per year at most, so I think it is not a big deal to have a human check (and download) latest versions, then automate the installation from the downloaded files.