How do I suppress the "Save a local copy" prompt in clear case? - clearcase

Background
In clearcase, whenever you uncheckout, or check in files, you get a prompt that says:
Save private copy of <file> ? [yes]
For each individual file.
Problem
I am trying to check in hundreds of files at once with a script and I know I don't want to save a private copy of any of them. How do I suppress this prompt so I don't have to manually enter n or no for each file?

In your script, you can cleartool checkout -rm or cleartool checkout -keep in order to not save, or save a copy of the file.
By using those options, you will get a non-interactive command and won't have to enter y/n for each file.

Related

How can use sendKey method in bat file?

first of all, I knew this question is duplicated but I'm new to bat file and I don't know how to develop this structure.
I want a bat file that works with windows task schedule at a specific time automatically.
I manually use this command in cmd
php\php.exe -f processmaker workspace-backup workflow
then I press enter in cmd to run this command
after that
I manually use this command in cmd
SET PATH=C:\Program Files\MySQL\MySQL server 5.6\bin
then I press enter in cmd again...
ok I want a solution to pressing "ENTER KEY" automatically between these commands.
Can you please help me?
If you edit a text file and name it, say mytask.bat
All the lines in it are executed as if in the command line, so try it, it should work.

Can't open file for writing when vim recover file with swp file

I want to recover the /home/lufei/market/resources/views/user.blade.php, here is the place of swp file.
> lufei#localhost:~/market$ ls resources/views/.user.blade.php.swp
> resources/views/.user.blade.php.swp
I use vim -r resources/views/.user.blade.php.swp to recover the file, I get this,
E306: Cannot open resources/views/.user.blade.php.swp Press ENTER or
type command to continue
When I use sudo vim -r resources/views/.user.blade.php.swp I can open the file, but when I use :wq in the vim I get
"/root/market/resources/views/user.blade.php"
"/root/market/resources/views/user.blade.php" E212: Can't open file
for writing Press ENTER or type command to continue
From the info above I think vim want to save the file to the root directory. From the vi - getting an error E212: Can't open file for writing, I guess if I create path /root/market/resources/views/ may work. But I want to directly save the file to the right place /home/lufei/market/resources/views/user.blade.php. So I use su && cd /home/lufei/market then vim -r resources/views/.user.blade.php.swp. But when I :wq in vim , I also get
"~/market/resources/views/user.blade.php"
"~/market/resources/views/user.blade.php" E212: Can't open file for writing
Press ENTER or type command to continue
From above trying, no matter I use normal user or the root user, when I recover the file, vim will try to save the file to the wrong place which path is not exist.
Can I directly recover the file to the right place, without create a temp path and then copy the recoveried file back to the right path.
Make sure you have enough access rights to open the file as lufei, and then start your recovery:
$ chmod u=rw resources/views/.user.blade.php.swp
$ vim -r resources/views/.user.blade.php.swp
This may be caused by the edit session crush like the items 2 in command sudo vim market/resources/views/user.blade.php. It make the swp file make the wong original file path. Note I really not have the /root/market/resources/views/user.blade.php file even the /root/market/ path. This is the first I create the file user.blade.php and without save it, and then shutdown the computer.
E325: ATTENTION
Found a swap file by the name "resources/views/.user.blade.php.swp"
owned by: root dated: Thu Nov 9 17:33:23 2017
file name: ~root/market/resources/views/user.blade.php
modified: YES
user name: root host name: localhost
process ID: 128985
While opening file "resources/views/user.blade.php"
(1) Another program may be editing the same file. If this is the case,
be careful not to end up with two different instances of the same
file when making changes. Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r resources/views/user.blade.php"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "resources/views/.user.blade.php.swp"
to avoid this message.
Swap file "resources/views/.user.blade.php.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:
Solution:
sudo vim market/resources/views/user.blade.php, if vim show above info, just press R and then save the file. If it not show above info, use :rec(over), then save the file.
use vim open any file env create a new file, with sudo vim aaa.txt, then use :rec(over) user.blade.php then save it. This will save the file to user.blade.php not the aaa.txt. Make sure the aaa.txt and .user.blade.php in same directory.

error Git after download. how do I remove file that cant be delete or move?

I download a file from http://msysgit.github.io/. The file got on to my harddrive without any problem. But now I can't move it, delete it, or even do anything with it. It seem like it crash right on the spot. How do I remove it from my pc?
First I tried moving the file and it did nothing. It just sit there a 0%. So I try stopping it. It didn't work. I relog in to my window. Than I try delete it. Same problem as before. I right click on file and than I click on properties. Nothing has happened.
From here: this manual page To power through you might need to open the command prompt as an administrator. I do that by clicking on Start, then in the "run" box I type "cmd". You will see cmd.exe show up. Right-click on it and choose run as administrator.
Here is the command to force delete a file that is read-only:
DEL /F C:\examples\MyFile.txt
Here is another interesting quote from that page:
Undeletable Files
Files are sometimes created with the very long filenames or reserved
names: CON, AUX, COM1, COM2, COM3, COM4, LPT1, LPT2, LPT3, PRN, NUL
To delete these use the syntax: DEL \.\C:\somedir\LPT1 Alternatively
SUBST a drive letter to the folder containing the file.
If a file (or folder) still appears to be 'undeletable' this is often
caused by the indexing service. Stopping the service will often enable
the file to be deleted.
I found a way. I used cmd and did a force delete. For other who have this problem:
Force delete using Windows
Enter the command prompt (Start-> Run-> Cmd). use cd
/d {path to folder}. than do enter ‘del {filename}’. Give it about 5min or less...

Installing exe through batch file

I am trying to install through batch file..
ECHO OFF
ECHO Installing MySoftware . . .
"%~dp0\MySoftware.exe" /S /v/qn"UPGRADEADD=link goes here"
pause
but it fails to install.
Not much info to go on. What you have will not work if executed from a UNC drive and may not work if you 'Run as administrator' because the current directory gets changed. Try this. Of course that may not fix it and further details would be nice.
#ECHO OFF
PUSHD "%~dp0"
ECHO Installing MySoftware . . .
"MySoftware.exe" /S /v/qn"UPGRADEADD=link goes here"
Adding to my answer based on comments provided.
Presumably your bat file is in the same folder as MySoftware.exe. If it takes that long, it sounds like the install is working. Try doing
"MySoftware.exe" /?
That may give you a help screen to tell you more about the arguments beng passed. Also, try what you are now doing without the /S (which probably specifies a "silent" install... which is why you don't see anything.
PART 1 - If you want to create a "Setup" File in batch.
Maybe it works, but this is will be very hard to you for done this program.
Let's call the EXE File "Game1:
I will recommend you to take all the Game1 file's code (Maybe you can use the program Notepad++ for do this) after you taked Game1's code do this like i writing here
Let's say that the code of Game1 is:
ABC
Copy the code, then go to the batch file.
The "Setup" file of Game1 HAVE to come with a empty EXE file.
You can make a empty EXE file with notepad - just save the file as:
Name.exe
Then you doing at the batch file script this thing:
set %something%=ABC
After you done this you adding this to the batch script:
Echo %something% >> Name.exe
Don't forget to name the EXE file at the name of the program / game.
And now, if this message didn't help to you, maybe you need to make a EXE from batch file.
PART 2 - If you want to make an EXE file of batch file.
Open the start menu of Windows and search this:
IExpress
Don't let the computer search for you the full name, its working only if you wtiting the full name.
After you search IExpress, click on "Activate Command".
Click on Next, Don't change the first options.
Click on "Extract files only" and click on Next.
Name the EXE program and click Next.
Stay on "No prompt." and continue.
Now you can display a program License. if you want do a txt file and choose the display option.
Add batch files and click Next.
click on the option you want and click Next.
If you want a finish message, click on display message and write the message.
Here browse where the EXE will be and choose your options, click Next.
click Next.
Wow that's was super-long! Hope I helped you!

Using inotify to keep track of all files in a system

Question:
Can inotify be used to reliably record files in a [linux] system?
Details:
I am attempting to use inotifywait to track users movements (currently using bash, but it has been suggested that I migrate to a scripting language). Ultimately I want to add new files to a database upon creation (create, moved_from), update existing rows in a database upon file modification (modify, attrib, move_to), and finally remove a row upon file deletion (delete). I am, however, running into many problems as even an action as seemingly simple as save, generates many inotifywait messages. Observe the following commands and their output (note, the use of /home/user/ is purely for example purposes):
Examples:
Example 1: Listen for file creation:
$ inotifywait -mr /home/user/ -e create --format %w:%f:%e:%T --timefmt %T
Touch:
$touch test.txt
/home/user/:test.txt:CREATE:21:35:30
Open a new file with vim then issue :w command:
$vim test2.txt
/home/user/:test2.txt:CREATE:21:35:30
Open an existing file with vim then issue :w command:
$vim test2.txt
/home/user/:4913:CREATE:21:35:30
/home/user/:test2.txt:CREATE:21:35:30
Open a new file with gedit then click save:
$gedit test3.txt
/home/user/:test3.txt~:CREATE:21:35:30
Open an existing file with gedit then click save:
$gedit test3.txt
/home/user/:.goutputstream-HN3ZDW:CREATE:21:35:30
/home/user/:test3.txt~:CREATE:21:35:30
Note that not only are two new files displayed as having ben created (4913 and .goutputstream-HN3ZDW), but also that the only file being created is test3.txt~ and not test3.txt, even though the file test3.txt is created when checked with the ls command. For completeness, here is the above example, but with a few more options.
Example 1: Listen for file creation, modification, deltion, and movement:
$ inotifywait -mr /home/user/ -e create -e modify -e delete -e moved_to -e moved_from --format %w:%f:%e:%T --timefmt %T
Touch:
$touch test.txt
/home/user/:test.txt:CREATE:21:35:30
Open a new file with vim then issue :w command:
$vim test2.txt
/home/user/:test2.txt:CREATE:22:12:32
Open an existing file with vim then issue :w command:
$vim test2.txt
/home/user/:4913:CREATE:22:04:35
/home/user/:4913:DELETE:22:04:35
/home/user/:test2.txt:MOVED_FROM:22:04:35
/home/user/:test2.txt~:MOVED_TO:22:04:35
/home/user/:test2.txt:CREATE:22:04:35
/home/user/:test2.txt~:DELETE:22:04:35
Open a new file with gedit then click save:
$gedit test3.txt
/home/user/:test3.txt~:CREATE:21:35:30
Open an existing file with gedit then click save:
$gedit test3.txt
/home/user/:.goutputstream-0WQ2DW:CREATE:22:06:34
/home/user/:test3.txt~:CREATE:22:06:34
/home/user/:.goutputstream-0WQ2DW:MOVED_FROM:22:06:34
/home/user/:test3.txt:MOVED_TO:22:06:34
Basically my question is "is it possible to use inotify to update a file in a database"? For example, if a user edits a file and saves it, I want it to be reflected in the database as an update to that file, and not a brand new file replacing a completely different file. Any help would be greatly appreciated, even if it's a suggestion pointing me in a different direction.
inotify tells you what happens like it happens.
Gedit, like most editors, saves by first writing a temporary file then moving that file into place. This avoids overwriting the file with a half-written version in case the editor or the whole system crashes while the file is being written. Vim takes a different approach (this can be configured, I won't go into details here — see e.g. why inode value changes when we edit in “vi” editor?): it first creates a temporary backup file, then writes the new file.
If you want these to be recorded as a single editing event, you'll have to perform some pattern recognition on the even log. A create-write-move sequence that replaces an existing file and a create-move-create delete sequence like vim's would be the archetypal patterns. Note that the pattern might be interleaved with other events.
I have a suspicion that there's a better way to do what you want to do, but I don't understand what you're trying to do. If you're trying to log user actions, you have already found a way, but there are simpler ways: loggedfs or the audit subsystem. If you want to keep a backup of all file versions, either hook up the editor to a version control system (this lets users control what gets backed up) or use a versioning filesystem such as copyfs. You can even store the files in the database directly, by using a filesystem like mysqlfs or postgresqlfs (admittedly neither project looks maintained).

Resources