system-administration

while loop in expect script

落爺英雄遲暮 提交于 2019-12-14 00:41:39
问题 I'm new to expect scripting, I want to write something like this: set variable; $variable = expect -exact "\/----Enter Password----\\" while { != $variable } { send -- {^[-} } I want to keep sending escape+hyphen character until I expect this prompt: "/----Enter Password----\". I have written the above code but it is not working. How do I do this, kindly help me. 回答1: You can make use of exp_continue to handle this situation. The command exp_continue allows expect itself to continue executing

Quick way to find if a port is open in all Local Network using Linux

谁说我不能喝 提交于 2019-12-13 06:27:19
问题 From a bash script how can I quickly find out whether a port 80 is open/listening on a server. On all workstations is opened daemon, but sometimes it fall, how i can check all files from file if port is open, i found a way to use nc -zw3 10.101.0.13 80 && echo "opened" || echo "closed" but how to use it in bulk from a file, my writed file look like: 10.101.0.13; 3333 10.101.0.15; 3334 10.101.0.17; 4143 10.101.0.21; 1445 10.101.0.27; 2443 10.101.0.31; 2445 10.101.0.47; 3443 10.101.0.61; 3445 I

Working with a MSSQL DB and a MySQL DB

江枫思渺然 提交于 2019-12-13 04:05:56
问题 I am working on a PHP script in a server. I have two databases: The first one is a MySQL DB and it is already imported to my server, so it is connected successfully. The second one is a MSSQL DB and I would like to import it from another server to mine. The problem is that I don't if I can install MSSQL somehow to the server and I haven't found any solution while searching for it or if I should connect to the two servers simultaneously. Could you maybe help me with that? What is the best

Expect script arrow keys

谁说胖子不能爱 提交于 2019-12-13 03:05:50
问题 I didn't know that how to send arrow keys using expect, hence I generated autoexpect script for all the arrow keys and found out that autoexpect generates this character for right arrow key: send -- "^[\[C" I used the same send command in my custom script and I'm getting a following error: while executing "send -- "^[\[C" expect eof " (file "script_auto.exp" line 38) What exactly shall I do to send the right arrow key. Any help would be appreciated. 回答1: "^[\[C" is an invalid string in Tcl .

How can I extract a subtree from my SVN repository into a new one?

送分小仙女□ 提交于 2019-12-12 07:57:02
问题 We have a Subversion repository with one directory that is: Not really in need of revision control beyond the capabilities of RCS Not versioned in conjunction with anything else in the repository Modified about six times as often as the rest of the repository Although I know that high revision numbers aren't a problem, nonetheless I'd like to pull this one single directory out of my main repository and into a second, ideally new one. What is the best process for that? If it makes a difference

Installing execSync using Puppet

拥有回忆 提交于 2019-12-12 06:17:17
问题 I am writing a Puppet module to setup an application on our test servers. The testing environment requires us to install a node package called execSync (https://github.com/mgutz/execSync). Since execSync is a native package, it gets compiled on installation. When I try to manually install it on the server, it gets installed. However, when I do the same thing using Puppet, compilation step fails. I have tried installing execSync using the puppetlabs-nodejs module (https://github.com/puppetlabs

How to check if every users on the system has administrator rights in C#

一世执手 提交于 2019-12-11 09:00:54
问题 I have a list of users created in my system: Administrator (by default) Guest User1 (Standard User) User2 (Administrator User) I want to know the rights given to all these users in C# through WMI ,how is this possible??Is there any other way to find them. Even If one user has this right it must exit from the loop I use the below code : WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsPrincipal principal = new WindowsPrincipal(identity); bool isAdmin = principal.IsInRole

Why dir_module does NOT seem to load, although clearly it is loaded in httpd.conf and modules folder?

こ雲淡風輕ζ 提交于 2019-12-11 06:48:20
问题 I checked the httpd.conf file which has "LoadModule dir_module modules/mod_dir.so " uncommented already. I also check the apache modules folder seeing that mod_dir.so is there too. BUT still the module_dir does not seem to have loaded at all. Because when I tried to set up this virtual folder, if I put the line Alias /myblog "D:/php/try" inside the ifmodule directive like the following: <IfModule dir_module> DirectoryIndex index.html index.htm index.php Alias /myblog "D:/php/try" <Directory

List Last Windows Password Change For All Users On A Non-Domain System

巧了我就是萌 提交于 2019-12-08 04:55:47
问题 I have found an answer to this question for systems that are attached to an AD domain controller. However, this question is for standalone systems where there is no possibility of attaching to a domain controller. Essentially, air-gapped systems. Short and sweet: Is there a way to list the last time each user changed their Windows password for a non-domain, air-gapped system (either Windows 7 or 10) all at once either as a batch file or PowerShell script? I know that net user {username} |

how to install rpm package to non-default path? [closed]

狂风中的少年 提交于 2019-12-06 08:20:54
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 8 years ago . i have a rpm package, and i need to extract some files from it. The package is not relocatable, i have try "rpm --root/--prefix", which doesn't work. what methods i should take to do the extraction? Thank In Advace. 回答1: if You need to extract some file only, use this commands: rpm2cpio rpmfile.rpm | cpio -idmv