I have my US Green Card which stipulates I must live in the Us.
Recently I had to move back to Canada due to family emergency.

Issue:
I recently crossed the border ( not showing my green card) and I got questioned. Eventually I told them I have a green card, they made me show it, they swiped my passport and warned me that I am not allowed to live in Canada and that I will need to fill out a re entry form.
I have to live in Canada until my family issue is resolved. I flew over to the US to visit other family for the holidays. I have to return to canada.
Question: 1. will canada customs be able to tell that I have a green card
2. what can customs see by swiping my pass port
3. what does one recommend I do in this situation? I do not want to lose my green card.

Thanks kindly