Can anyone help me how to find time and date when the ClearCase (UCM) VOBS are last accessed ?
I remember using cleartool lshistory to check the last events date occurred on a vob.
Something like:
cleartool lshis -fmt "%Xn\t%Sd\t%e\t%h\t%u \n" -since 01-Oct-2015 -all <vobname>| grep -v lock | head -1 | grep -o '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]'
That would give the events on the last 6 months (like "create version", "create branch", ...).
If there are none, the VOB has not been accessed recently (and I then consider archiving it).
This apply for any VOB (UCM or non-UCM).
'lshistory' will certainly give you the most recent change to the PVOB. If you are interested in the last-accessed time, you can look at the DB files for the PVOB. For instance,
% ls -ltur <pathname_to_VOB_storage_directory>/db
That will sort by last-accessed-time of each file and the latest of those files, which would be the last listed because of the '-tr' flags, should include the time close to the last time the PVOB was accessed. For example:
-rw-r--r-- 1 vob_owner vob_group 94830592 Mar 28 2016 vob_db.d05
This PVOB was last accessed on March 28, 2016.
Related
I have somehow created a branch of a file in clearcase UCM that is not part of an activity. I have no idea how to reproduce this, but my stream is showing many files with this symptom. How can I find these files, remove them, and prevent it from happening again in the future?
Here is an example of one such file, names redacted to protect the innocent:
xxxxxxxxxxx.cpp##/main/xxx-integration/xxxxxx-xxxxxxxx/0 Rule: .../xxx-xxxxxxx/LATEST
A ct lsact -long | grep <filename> returns no results.
Update:
I used a find command to track down all the files that are on the branch given (and redacted) above, though I still do not understand the issue.
Per VonC's answer, where is what I ended up doing:
cleartool find . -type f -version "version(.../xxx/LATEST)&&version(.../xxx/0)" -print | tee ~/tmp/files2
I then read through the list of files generated to make sure they made sense, then I verified they were not attached to an activity and removed the versions:
cat ~/tmp/files2 | while read
do
if [ -z "$(ct describe -fmt "%[activity]p" $REPLY)" ]
then
ct rmbranch -f ${REPLY%/0}
fi
done
That can happen ig those file were checkout in a base ClearCase view, ie a non-UCM view, withg a simple config spec:
element * .../xxx-integration/LATEST -mkbranch xxxxxx-xxxxxxxx
You can use a find command similar to "How can I find all elements on a branch with version LATEST that has no label applied?".
The difference is: for each version found, you need to describe it in order to check if there is an activity attached to it or not (with a fmt_ccase):
cleartool describe -fmt "%[activity]p" "$CLEARCASE_XPN"
I installed webalizer on my apache 2 webserver yesterday and came across the problem, that all the old access logs are not used. The directory list looks like that:
/var/log/apache2/
access.log
access.log1
access.log.10.gz
access.log.11.gz
...
How can I import all my files at once?
I tried several things, but it was telling me, that the records were ignored.
Hope somone can help. Thanks!
I ran into the same problem. I had just installed webalizer, and changed it to incremental mode (here are the relevant entries from my /etc/webalizer/webalizer.conf):
LogFile /var/log/apache2/access.log.1
OutputDir /var/www/htdocs/w
Incremental yes
IncrementalName webalizer.current
And then I ran webalizer by hand, which initialized the non-gz files in my logs directory. After that, any attempt to manually import an older gz logfile (by running webalizer /var/log/apache2/access.log.2.gz for instance) resulted in all of the entries being ignored.
I suspect this is because the entries found in the gz logs were older than the last import- I had to delete my webalizer.current file (really I cleared the whole dir- either way should work). Finally, in reverse order (oldest first), I could import the old gz files one at a time:
bhs128#home:~$ cd /var/log/apache2
bhs128#home:/var/log/apache2$ sudo rm -rf /var/www/htdocs/w/*
bhs128#home:/var/log/apache2$ ls -1t /var/log/apache2/access.log*gz | grep -o [0-9]* | tail -n1
52
bhs128#home:/var/log/apache2$ for i in {52..2}; do webalizer /var/log/apache2/access.log.$i.gz; done
I just had the same problem, and I took a look into the webalizer.current file:
$ head -n 2 webalizer.current
# Webalizer V2.21-02 Incremental Data - 11/05/2019 22:29:02
2019 11 5 22 29 2
The second line seems to contain the timestamp of the last run, so I just changed the year to 2018. After that, I was able to import older log files than the last imported ones, without having to delete all the data first.
On clearcase machine, Let say i have a file called xyz.c.
I have checked out the file using command
jco -nc xyz.c
now i did some changes and checked-in the file(not submitted yet) using below command
jci -nc xyz.c
I have now a new version created for the file xyz.c, which we can see by below command
jlog xyz.c
---------------------------------------------------------------------------
Date: 04-May-11.13:05:02 User: abc
Event: create version
Version: xyz.c##/main/1
Comment:
---------------------------------------------------------------------------
Date: 28-Apr-11.12:19:51 User: abc
Event: create version
Version: xyz.c##/main/0
Comment:
---------------------------------------------------------------------------
Date: 28-Apr-11.12:19:51 User: abc
Event: create branch
Version: io.c
Comment:
---------------------------------------------------------------------------
Let say i have again checked out for my coding purpose and checked in again
which created version 2.
My question is : if i am on version 2, How can i delete the version 2 so that i can get my version 1. Note : version 2 is checked in but not submitted yet.
If you have checked in version 2 and:
don't have set any label on it
don't have create new other version on it
you could do a cleartool rmver xyz.c##/main/2, but that is quite dangerous and not recommended.
A revert (as I wrote here) would be:
cleartool merge -graphical -to xyz.c -delete -version \main\2
Another (less complex) option would be to hijacking the content of xyz.c with version 1, that is just replace the local copy (you would need then to checkout and checkin in order to create a version 3.
See SO answer on cleartool get:
cleartool get –to xyz.c xyz.c##\main\2
Your question is not very clear in terms, whether you have already checked in version 2 or not. In case you have not checked in version 2, you have to uncheckout the file. If you have checked in the file, you will need a rollback
My question is : if i am on version 2,
How can i delete the version 2 so that
i can get my version 1.
I do not think you do not have to delete it as such, my interpretation is that you just want to see the older version 1 at some point after version 2 is created, is that right?
All versions of the content of the file (e.g. versions /main/0, /main/1 and /main/2) are stored in the VOB. However, when you work with clearcase you are not accessing the VOB directly, you are working with a view and all file access goes through the view server. The config specification will determine what versions of a file your view will select.
So if you specifically want to see version 1 of the file you can add
element xyz.c /main/1
to the config_spec before the rule that would otherwise select a version (use cleartool ls -l to check).
Also I notice you use commands jco, jci and jlog which is not the same as the standard clearcase commands cleartool co, cleartool ci and cleartool lshistory. So it seems like you are using some additional interface layer, there might be some issues with this.
You can also just bring up the version tree on the file graphically and right-click on the latest version and select delete.
I created a branch type one month ago , but for some reason delayed to use it until now. But now I just have a vague memory of the branch name but not very sure about it
. So I'm wondering if clearcase has the feature that list all the branch type create by a person, in my case just me, then I can find the exact name of the branch type I created one month ago . Need your help, thanks in advance .
You can list the brtype of a vob, displaying only what you need with fmt_ccase directives:
cleartool lstype -kind brtype -invob \myVob
would be enough to do some grep, but for a more compact output:
cleartool lstype -kind brtype -invob \myVob -fmt "%u %Ad %N\n"
You would only have the username, the date and the name of the brtype, for you to grep.
Note the %Ad parameter: age in days, to be able to quickly spot brtype created 30 days or so ago.
cleartool lstype -kind brtype | grep username works for me on Linux.
newbie for clearcase.
Since clearcase's config is rather different from other concept in git, I may mean logs for
any files with specified version/branch path.
Like I want to show log for all element match:
element * .../specified-lable-or-branch/
First you need to be aware of the differences between ClearCase and Git, ClearCase being file-centric (no notion of repository-wide revision or commit)
You can display logs for any visible file by typing:
cleartool lshistory /myView/myVob/path/to/myFile
See lshistory man page. (and also How do I understand about ClearCase event records in the VOB database)
The lshistory command lists event records in reverse chronological order, describing operations that have affected a VOB's data.
File system data history.
Lists events concerning elements, branches, versions, and VOB links.
This includes records for creation and deletion of objects, and records for attaching and removal of annotations: version labels, attributes, and hyperlinks.
Another kind of logs is the lsvtree (history of versions):
The lsvtree command lists part or all of the version tree of one or more elements.
By default, the listing includes all branches of an element's version tree except for obsolete branches.
alt text http://youtrack.jetbrains.net/_persistent/tree.PNG?file=74-3724&v=1&c=true
The OP adds:
How can I display all history for elements match a pattern like has new version under a branch?
You can combine almost any commands with a find query.
Windows syntax:
cleartool find . -name "apattern" -exec "cleartool lshistory \"%CLEARCASE_PN%\""
cleartool find . -version "{created_since(target-data-time)}" -exec "cleartool lshistory \"%CLEARCASE_PN%\""
Unix syntax:
cleartool find . -name "apattern" -exec 'cleartool lshistory "$CLEARCASE_PN"'
cleartool find . -version "{created_since(target-data-time)}" -exec 'cleartool lshistory "$CLEARCASE_PN"'
For the " like has new version under a branch?" specifically:
cleartool find . -version "brtype(mybranch)" -exec ...
should do it (any element which has no version created for that branch will not be listed).